Hi, I am using the multi language in a site and it is working fine. But during the ajax call the correct content is not getting displayed. EX: This is the content and it is loading correctly on page load. "Elégance" But during the ajax call the text is broken and showing as "El�gance" and in mozilla it is showing as QUESTION INSIDE THE DiAMOND . I have added the charset ISO-1859-1 in the php file (mb_ internal_ encoding ("ISO-8859-1") Js file as xmlHttp . setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); My question is why is it working fine on page load and not in the ajax call.? Please advice me.
tried changing the charset of the JS to ISO? why you use a different charset there? and why using "é" anyway? its not a german character, if iam not wrong its used in french
Yeap..I dont know how to fix this issue ,So i tried all the possibilities to fix it. Thats the reason i changed the js charset too. And yes it is french one ,I am in confused state. Do u have any idea? why it is occuring in the ajax call only.
Hmm ive read this, ill try to search a bit on how to fix it, but it seems that is your problem, your ajax need to be ISO, but "AJAX calls are always UTF-8 encoded because a) the browser internally uses the character encoding of the OS and b) javascript uses UTF-8. UTF-16 is commonly used for internal character encoding by many OS-es, e.g. Windows. So when the AJAX call is made the browser converts the UTF-16 encoding (loss less) to UTF-8. setForm() urlencodes the form using this UTF-8 encoding, regardless of what the character encoding of the HTML page is or what character encoding the user has chosen in the browser." So you need to decode your sended data either using utf8_decode function, which convert characters sent using utff8 to iso or using application/x-www-form-urlencoded;charset=UTF-8 when the data is sent using ajax But dont ask me how to implement that