I have the same problem.  I’m not entirely sure how to fix it, but I will probably be working on it this weekend.  If I figure it out, I’ll let you know.

 

One thought that occurs to me, that I haven’t tried, but it might work.

 

Can you put a charset in the <script> tags?  Like:

<script type=”text/_javascript_; charset=ISO-8859-1”> (or some other method perhaps?).  That might set _javascript_ into the correct encoding.

 

Just a thought, if you have some time to research and try it out, let me know how it goes.

 

Greg

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rahul Bhargava
Sent: Friday, April 14, 2006 7:23 AM
To: rails-spinoffs@lists.rubyonrails.org
Subject: [Rails-spinoffs] character encoding in ajax submit

 

Hey all,

 

Anyone got some quick advice on international character submission via Prototype’s Form.Serialize? 

 

The base scenario:

I set the charset on my page to ISO-8859-1, which seems to be what everyone uses.  If I submit a regular form with a standard webpage, I get international characters (like an accented “e”, or and AE legature) encoded as 1-byte ascii code values.

 

The problem scenario:

When I submit the same thing with Prototype over XMLHttpReq with the parameter set to a Form.Serialize of some form, I get that same character encoded in what looks like its 2-byte Unicode representation.

 

The real question:

Basically it boils down to the built-in encodeUrlComponent returning 2-byte encodings, while the browser seems to do a 1-byte encoding.  My server isn’t handling the 2-byte encoding correctly.  It seems weird to me that the two methods would produce differing results.  Am I doing something wrong?

 
Thanks again for any tips!
 
Rahul
 
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to