SPUG: ajax character encoding issue solved, but WHY?

Phil Mitchell phil.mitchell at pobox.com
Wed Jun 10 12:40:32 PDT 2009


I solved the character encoding issue that I wrote about earlier, but I
don't understand why the fix works. I'm hoping someone can explain this to
me!

The issue was that non-ascii chars were appearing as junk BUT only when
retrieved via ajax calls. Otherwise, they displayed fine. The junk display
was due to them being interpreted as ISO-8859-1, but I could not figure out
why the browser was interpreting that way. All my data is handled as UTF-8.

The problem was fixed by calling Encode::decode on the data prior to sending
back via ajax. BUT WHY?

I am using the JSON view to render ajax responses, and it sets the charset
header correctly to UTF-8. Of course, even when you decode, perl still
represents as "internal" utf8. But why should this be necessary?

-- 
==========================
http://www.bikewise.org

2People citizen's network for climate action: http://www.2people.org

Greater Seattle Climate Dialogues: http://www.climatedialogues.org
==========================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/spug-list/attachments/20090610/18b6f18c/attachment.html>


More information about the spug-list mailing list