<div class="gmail_quote">On Tue, Jun 16, 2009 at 9:55 AM, Johnston, Mark <span dir="ltr">&lt;<a href="mailto:mark.johnston@pnl.gov">mark.johnston@pnl.gov</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">





<div>
<div dir="ltr" align="left"><span><font color="#0000ff" size="2" face="Arial">Phil,</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" size="2" face="Arial"></font></span> </div>
<div dir="ltr" align="left"><span>    <font color="#0000ff" size="2" face="Arial">This is a shot in the dark, but is the encoding 
on the page that interacts with the web service via AJAX by chance ISO-8859-1 
(either set explicitly or by default on the server)?  </font></span></div></div></blockquote><div><br>No, all my html is served with charset=UTF-8<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div><div dir="ltr" align="left"><span><font color="#0000ff" size="2" face="Arial">You didn&#39;t 
mention whether &quot;utf8&quot; or &quot;UTF-8&quot; is the character encoding you are now 
specifying when calling Encode::decode on the JSON text stream, so I&#39;m not sure 
how that might have affected the resulting text stream as it enters the wire 
between the two processes.</font></span></div></div></blockquote><div><br>It doesn&#39;t seem to matter, both work. In fact, I ended up using utf8::decode, thinking perhaps it is the most efficient.<br><br>I remain puzzled, but thanks for thinking about it!<br>

<br>Phil<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div dir="ltr" align="left"><span><font color="#0000ff" size="2" face="Arial"></font></span></div>


<div dir="ltr" align="left"><span><font color="#0000ff" size="2" face="Arial"></font></span> </div><br><div><font color="#0000ff" size="2" face="Arial"></font> </div><br>
<div dir="ltr" align="left" lang="en-us">
<hr>
<font size="2" face="Tahoma"><b>From:</b> 
spug-list-bounces+mark.johnston=<a href="http://pnl.gov" target="_blank">pnl.gov</a>@<a href="http://pm.org" target="_blank">pm.org</a> 
[mailto:<a href="mailto:spug-list-bounces%2Bmark.johnston" target="_blank">spug-list-bounces+mark.johnston</a>=<a href="http://pnl.gov" target="_blank">pnl.gov</a>@<a href="http://pm.org" target="_blank">pm.org</a>] <b>On Behalf Of </b>Phil 
Mitchell<br><b>Sent:</b> Wednesday, June 10, 2009 12:41 PM<br><b>To:</b> 
<a href="mailto:spug-list@mail.pm.org" target="_blank">spug-list@mail.pm.org</a><br><b>Subject:</b> SPUG: ajax character encoding issue 
solved, but WHY?<br></font><br></div><div><div></div><div class="h5">
<div></div>I solved the character encoding issue that I wrote about earlier, but 
I don&#39;t understand why the fix works. I&#39;m hoping someone can explain this to 
me!<br><br>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.<br><br>The problem was fixed by calling Encode::decode on the data prior 
to sending back via ajax. BUT WHY?<br><br>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 &quot;internal&quot; utf8. But why should 
this be necessary?<br clear="all"><br>-- <br>==========================<br><a href="http://www.bikewise.org" target="_blank">http://www.bikewise.org</a><br><br>2People 
citizen&#39;s network for climate action: <a href="http://www.2people.org" target="_blank">http://www.2people.org</a><br><br>Greater Seattle 
Climate Dialogues: <a href="http://www.climatedialogues.org" target="_blank">http://www.climatedialogues.org</a><br>==========================<br></div></div></div>
<br>_____________________________________________________________<br>
Seattle Perl Users Group Mailing List<br>
     POST TO: <a href="mailto:spug-list@pm.org">spug-list@pm.org</a><br>
SUBSCRIPTION: <a href="http://mail.pm.org/mailman/listinfo/spug-list" target="_blank">http://mail.pm.org/mailman/listinfo/spug-list</a><br>
    MEETINGS: 3rd Tuesdays<br>
    WEB PAGE: <a href="http://seattleperl.org/" target="_blank">http://seattleperl.org/</a><br></blockquote></div><br><br clear="all"><br>-- <br>==========================<br><a href="http://www.bikewise.org">http://www.bikewise.org</a><br>

<br>2People citizen&#39;s network for climate action: <a href="http://www.2people.org">http://www.2people.org</a><br><br>Greater Seattle Climate Dialogues: <a href="http://www.climatedialogues.org">http://www.climatedialogues.org</a><br>

==========================<br>