jQuery AJAX Character Encoding
UTF-8 is supposed to handle all accents and foreign chars - why not use it on your data source?
EDIT
[Archive copy of the test file.] with your data
Everything should be UTF-8 in the first place. I loaded the files in notepad++, converted to utf-8 and manually changed the charactes to accents were needed. Once done everything's working like a charm.
BTW, unless your server is defined to php-process .html files, the files you're loading with ajax aren't getting your iso charset. If you insist on using the iso charset, request a php file instead of an html file, and define the charset in the header (not in the file itself)
Specifying the content type on the AJAX-call solved my problems on a Norwegian site.
$.ajax({
data: parameters,
type: "POST",
url: ajax_url,
timeout: 20000,
contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15",
dataType: 'json',
success: callback
});
You would also have to specify the charset on the server.
<?php header('Content-Type: text/html; charset=ISO-8859-15'); ?>
You need to set up your server to use ISO-8859-15 as the character encoding (adding the appropriate HTTP header). Doing it in the body of the html won't help.
I can see this line
<?php header('Content-Type: text/html; charset=ISO-8859-15'); ?>
at the source of your html. This shouldn't happen. Using Live HTTP Headers I can't see the appropriate charset HTTP header. Use that for both your first page and the ajax service.
$str=iconv("windows-1250","UTF-8",$str);
what helped me on the eventually