Hi, I try to use the JSON encoder/decoder on JSON string receive from an HTTPRequest. And it failed to handle characters with accents (çéèà...) giving me an parsing Exception. I think because the convertion from string to object is a simple eval ! This make Protoype unusable for non americain characterset application ! Or I miss something ! Sad ! Constant --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hey Constant, First, JSON issues do not make Prototype unusable: only its JSON parts. Second, in JSON, all of your strings, be they property *names* or property values, are supposed to be properly quoted. Are yours? Finally, you''ll need to make sure your HTTP response specifies the proper charset in its Content-Type header. Perhaps your issue is more akin to returning, for instance, a ISO-8859-1 text with a UTF-8 charset. -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
You are wright, It''s only the JSON part that is unusable. But it''s so frustrating. And Prototype dooesn''t work if I use the JSON library comming from www.json.org. When I use YUI library to request JSON data from PHP and use JSON.org lib everything work''s fine. Both library (js and php) escape accents to send it on the wire. So fare I handle it I set everything to UTF-8. Is use <meta http-equiv="Content-Type" content="text/html; charset=utf8" /> in my HTML pages. I think I read that only ascii can be send on the wire ? Constant On 12 avr, 10:49, Christophe Porteneuve <t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org> wrote:> Hey Constant, > > First, JSON issues do not make Prototype unusable: only its JSON parts. > > Second, in JSON, all of your strings, be they property *names* or > property values, are supposed to be properly quoted. Are yours? > > Finally, you''ll need to make sure your HTTP response specifies the > proper charset in its Content-Type header. Perhaps your issue is more > akin to returning, for instance, a ISO-8859-1 text with a UTF-8 charset. > > -- > Christophe Porteneuve aka TDD > t...-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
> Is use <meta http-equiv="Content-Type" content="text/html; > charset=utf8" /> in my HTML pages.This is only a fallback solution for the browser. The thing that counts is the header that the webserver sends. Only if this is missing your line might be used. Jonathan -- Jonathan Weiss http://blog.innerewut.de --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Constant, Macfurax, Can you elaborate in this issue? Prototype''s JSON parser is mapped on json.js, so I''m really surprised you are having issues. Sound''s more like a header problem to me. Could you maybe post some code? Thanks and best regards, Tobie --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
I just did a quick test here: http://sandbox.tobielangel.com/ and all seems to work as expected on the JSON side of things. Looks like its definitely a header/url encode issue. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Ok so I missed something. What I intent to do is a admin application to store informations on a web serveur. These informations will be used by Flahs, PHP and Ajax applications. The flow is : 1) Admin page (HTML) use form to encode data and send it via a POST to the PHP backend // this use POST by default send( $(''requestURL'').value , "title="+$(''dataTitle'').value +"&description="+$(''dataDescription'').value ); // I think here accents are replaced by \u00e9 like strings 2) The backend store the data (in JSON files for the moment) // this save the object in JSON file using the JSON.org PHP lib $newObj = $dm->create(); $newObj->id = $this->id; $newObj->title = $_POST[''title'']; $newObj->description = $_POST[''description'']; return $dm->save( $newObj ); 3) The admin pas collect the information from the server to display them var obj = o.responseText.evalJSON(); This is in this last step I got a problem. .... I''m confused ! I was modifying a test console page to show you my problem. And now it works :-? Using YUI : http://www.constantdupuis.be/t/kosmotor2/testConsole.html Using Prototype (1.5.1_rc2) : http://www.constantdupuis.be/t/kosmotor2/testConsolePrototype.html I don''t understand ! Sorry ! ... I really missed something ! Thanks and Regards, Con(fused)stant On 12 avr, 21:20, "tobie" <tobie.lan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I just did a quick test here:http://sandbox.tobielangel.com/and all > seems to work as expected on the JSON side of things. > > Looks like its definitely a header/url encode issue.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---