Re: [Catalyst] ajax character encoding issue solved, but WHY?

2009-06-19 Thread Moritz Onken


Am 19.06.2009 um 06:23 schrieb seasproc...@gmail.com:

I had a character encoding issue that I finally solved, 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 utf8::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?


Thanks!



What is the encoding of the web page that issues that ajax request?
Does this occur on different browser as well?
I had similar problems and solved it by making sure that
every page has the utf8 encoding header set.

IMHO using utf8::decode is a hack and should be avoided if possible.

moritz

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


Re: [Catalyst] ajax character encoding issue solved, but WHY?

2009-06-19 Thread Phil Mitchell
On Fri, Jun 19, 2009 at 12:52 AM, Moritz Onken on...@houseofdesign.dewrote:


 Am 19.06.2009 um 06:23 schrieb seasproc...@gmail.com:
 What is the encoding of the web page that issues that ajax request?


charset=UTF-8



 Does this occur on different browser as well?

yes (tested on FF and IE)


 I had similar problems and solved it by making sure that
 every page has the utf8 encoding header set.

 IMHO using utf8::decode is a hack and should be avoided if possible.


I totally agree, but it needs to be fixed!




 moritz




-- 
==
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@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] ajax character encoding issue solved, but WHY?

2009-06-19 Thread Francesc Romà i Frigolé
On Fri, Jun 19, 2009 at 6:23 AM, seasproc...@gmail.com wrote:


 The problem was fixed by calling utf8::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?



I had exactly the same problem and solution using Catalyst::Controller::REST
with the JSON serializer. Still in my list of 'big mysteries to be solved'.


I hadn't discovered Catalyst::Plugin::Unicode back then, I wonder if using
it would help, haven't tried myself yet.

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


[Catalyst] ajax character encoding issue solved, but WHY?

2009-06-18 Thread seasprocket
I had a character encoding issue that I finally solved, 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 utf8::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?

Thanks!



-- 
==
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@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/