Are you absolutely sure that your server is returning UTF-8 text to you? Look in Firebug at the actual response headers and see to be sure.
If you're on Apache, there is a preference for auto-charset that you have to tweak or disable, and if you're using a PHP back-end, you often have to go through a couple of hoops to force the output to be UTF-8. In my own framework, this starts by sending a SQL query to the database to force the connection to UTF-8, followed by making sure that all of my scripts are themselves saved as UTF-8, and often also sending a Content-type/charset header before every print to the screen, just to overstate the obvious to Apache. Walter On Mar 31, 2009, at 6:24 PM, Jérémie wrote: > > Hello eveyone, > > Today I have experimented a weird behaviour with Ajax stuff in > prototype : > Having the JS code above, I retrieve a UTF-8 HTML fragment with > special chars like é, à , ù, etc : > > var cible = '/lib/ajax/chargementGrille' > + ('S' == modeAffichage ? 'Secretaire' : '') > + '.php'; > > new Ajax.Request( > cible, > { > encoding : 'UTF-8', > postBody : data, > onComplete : function(transport) { > try { > $('grille').innerHTML = transport.responseText; > ... // some additionnal treatment ... > } catch(e) { > console.log(e); > } > } > } > ); > > My response headers indicate that I receive UTF- 8 text/html data, as > expected, but > the fact is that the chars are displayed properly until I reach the > line > $('grille').innerHTML = transport.responseText;. Then they are > replaced with é", "î", ... > It's clearly shown by executing the JS code line by line with Firebug. > If I delete this line, everything is OK, but how the hell Javascript > knows that I want this portin of HTLM code replaced by the one > received byh AJAX ? > > The same thing happens directly with an Ajax.Updater function, without > any onComplete block.... > > Please help, I've spent so many time to find out the trick.... > > Thanks in advance, > > Jérémie > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---