NYCPHP Meetup

NYPHP.org

[nycphp-talk] AJAX and character encoding

Marc Antony Vose suzerain at suzerain.com
Sun May 7 16:45:27 EDT 2006


Hi all:

I've run into a perplexing problem.

I'm dealing with a situation with a client where all of their content 
is being dumped from an old version of FileMaker (5.5), and it is 
coming out as windows-1252 encoded.

Though I always suggest that my clients have text encoded in UTF-8, 
since it is then prepared for internationalization in a sensible way, 
in this instance, I dealt with the windows encoding in order to save 
myself the headache.

However, we ran into a site feature of theirs that basically required 
AJAX, because they wanted to display an endless bunch of data in a 
small place without a page reload required to see more items.  I 
didn't know until I built the feature that AJAX requests default to 
UTF-8.

Of course, it seems that most browsers detect that the page the 
content is coming into is encoded as windows 1252...except...you 
guessed it...Internet Explorer for Windows.  So, in that browser, my 
extended characters are being mangled.

Some searching around uncovered this blog article which outlines a 
potential workaround:

http://www.taylanpince.com/blog/AJAX-and-Multibyte-Character-Support.html

The problem is, the workaround relies on the mb_string functions, 
which unfortunately are not active on the server I have to work on.

So, the question is....am I SOL, or has anyone here ever devised a 
cleverer solution to this problem?

Of course, my preferred solution is to just have all the content be 
UTF-8 encoded...I'm also speaking with the client to see if his 
programmer can dump out the data in that format.  But I'm trying to 
hedge my bets.

Thanks,

-- 
Marc Antony Vose
http://www.suzerain.com/

Imagination is more important than knowledge.
-- Albert Einstein



More information about the talk mailing list