Nintendo Wii forums Forum for writers phpBB mods Essays on copyright Dating advice Narnia forums

Greasemonkey: PHP multi-byte string warnings

Just a quick note to say that I released a new Greasemonkey script.  It adds a warning box of text to any manual page that features a function that is dangerous to multi-byte strings.  I'm sorry, you want that in English?  OK.  Have you ever posted something to a Web site and found that characters were missing or truncated or there were lots of question marks or boxes where letters should have been?  Usually that's because the person running the site doesn't understand how letters work at a programming-language level.  They think everyone on Earth is using an English keyboard with the letters A-Z.  When they get data that isn't A-Z, their Web site programs don't know what to do with the data, and they mangle it.

It turns out most people don't use just the A-Z characters, even people who write in English.  Lots of people want to use the Euro symbol, for example.  That isn't a "normal" letter, and so lots of Web sites just mangle it.  Part of the problem is the programming language used on these Web sites.  In particular, the PHP language has two main "modes" for handling characters.  The first, and the default, is basically to treat everything like ASCII.  ASCII is the A-Z standard.  Unfortunately, that severely damages the text that people type nowadays.  So PHP has a second major mode of operation, and that is to set itself to UTF-8.  UTF-8 includes lots and lots of characters, and it's backwards compatible with ASCII.  So pretty much every Web geek should use it. 

The problem?  The online PHP manual doesn't offer much of a warning any time you look up one of the old, bad ASCII functions.  I personally replaced some old, bad code with... you guessed it... more old bad code.  Why?  Because I looked up replacement functions and found what I thought would work, only to realize that the replacement functions were also bad and came with NO disclaimer!  And that leads us to my Greasemonkey script.  This script will add disclaimers to, on any page containing a bad old function.  If possible it will also tell you a better way to do what you want to do.  It's basically code help for PHP developers.

You can get the script on  Please install it and then view some of these pages to see the disclaimers it adds:


« Barack Obama, Jeremiah Wright | Main | New Greasemonkey script: Slashdot nuzak CSS »

Nav by tag: greasemonkey
« Greasemonkey script: Digg Done That | Main | New Greasemonkey script: Slashdot nuzak CSS »
Nav by tag: multibyte
Nav by tag: php
« Doing MySQL's GROUP_CONCAT with PHP code | Main
Nav by tag: tech
« Greasemonkey script: Digg Done That | Main | New Greasemonkey script: Slashdot nuzak CSS »
Nav by tag: utf8
Bookmark It! Technorati Netvouz DZone ThisNext Wists blinkbits BlinkList blogmarks blogtercimlap Blue Dot Bumpzee co.mments connotea DotNetKicks Fark feedmelinks Fleck Furl Gwar Haohao Hemidemi IndiaGram IndianPad Internetmedia LinkaGoGo Linkter Ma.gnolia MyShare Netscape NewsVine PlugIM PopCurrent ppnow RawSugar Reddit Shadows Simpy Slashdot Smarking Spurl Webride YahooMyWeb

TrackBack URL for this entry:

Comments (2)
rank writes:

Having read this I thought it was extremely informative. I appreciate you finding the time
and energy to put this information together.
I once again find myself personally spending
way too much time both reading and posting comments.

But so what, it was still worthwhile!

Pure Logic writes:

Exceptional! Keep writing. :-D

Post a comment

Verification (needed to reduce spam):