NYCPHP Meetup

NYPHP.org

[nycphp-talk] AJAX and character encoding

csnyder chsnyder at gmail.com
Mon May 8 09:28:09 EDT 2006


On 5/7/06, Marc Antony Vose <suzerain at suzerain.com> wrote:
> 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
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
> New York PHP Conference and Expo 2006
> http://www.nyphpcon.com
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>

Character encoding is a state of mind... by which I mean, what happens
if the page that the data is being sucked into has the 1252 encoding,
in IE only? But I guess then you'd have to convert the rest of the
page to 1252 for IE, which probably means you're back where you
started.

You could build a web service on a cheapo server that had mb_string
support, and pass all the calls through that (caching them, of
course).

This will be an ongoing problem as all those systems which were built
before unicode come due for rewrites.


--
Chris Snyder
http://chxo.com/


More information about the talk mailing list