« Return to Thread: ajax character encoding issue solved, but WHY?

Re: Re: ajax character encoding issue solved, but WHY?

by seasprocket :: Rate this Message:

Reply to Author | View in Thread

On Sat, Jun 20, 2009 at 3:50 AM, Aristotle Pagaltzis <pagaltzis@...> wrote:
* seasprocket@... <seasprocket@...> [2009-06-19 06:30]:>
> The problem was fixed by calling utf8::decode on the data prior
> to sending back via ajax. BUT WHY?

Looks like your code is broken and assumes bytes throughout; as
long as all your data is UTF-8 you won’t notice. Apparently the
JSON serialiser is trying to produce UTF-8 output correctly by
encoding the strings you pass it; since they’re already encoded,
you get double-encoding gremlins.

Thanks for your suggestion, but I'm pretty sure that the data is not getting encoded twice. C::V::JSON tests the data before it encodes ( Encode::is_utf8() ) and only encodes if this test is true. This test only passes if the data is decoded.

I have confirmed this by checking to see if Encode::encode is getting called in C::V::JSON (it's not).

I agree something's broken, I just don't know what it is ... My suspicion is that I don't really understand what's happening inside sqlite -- I assume it's storing as UTF-8, but I don't really know what it's doing.

 


Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/



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

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

Greater Seattle Climate Dialogues: http://www.climatedialogues.org
==========================

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

 « Return to Thread: ajax character encoding issue solved, but WHY?