My problem is with ajax requests that must return html and not JSON.
So, if i receive a string from POST like "La vita è bella" and save it into DB without apply utf8_decode i'll get a string like "La vita ù bella".

I'm looking for an automatically method or best practise to deal with it.

Thank you for answer.



Citando Nicolas Grevet <[email protected]>:

Yeah, that's what we did.
But it would be great if Zend_Json_Encoder could automate the process.
Auto-encode in the encoder, auto-decode in the decoder. But well,
there's much more important things to do for the moment.

Dmitry Dulepov a écrit :
Hi!

On 4 Feb 2010, at 11:03, Nicolas Grevet wrote:
We have the same problem in french, we're using ISO/IEC 8859-15. By the way, I've yet to hear about a way to change string encoding in javascript.

Theoretically you can but practically you can't. PHP expects UTF-8 in json_decode and json_encode. UTF-8 is a default encoding for JSON in all browsers. And MSIE fails if you append "charset" header to content type for JSON. So you are much safer with UTF-8 in json.

----
Dmitry Dulepov
Twitter: http://twitter.com/dmitryd/
Web: http://dmitry-dulepov.com/






Reply via email to