Internationalization problem when load url file - latin (pt_BR) characters failed to show.

Internationalization problem when load url file - latin (pt_BR) characters failed to show.

rodrigopandinirodrigopandini Posts: 4Questions: 0Answers: 0
edited April 2012 in General
Hi,

I have a problem here when I try load an internationalization file.
The problem is some characters in my native language (pt_BR), like "ç", "á", "ã", "â", etc, don´t display correctly.
These characters are from " Latin-1 Supplement: Unicode range 0x00A0 to 0x00FF. Includes punctuation, currency symbols, numerals and common accented characters".
This problem occours because, I believe, the ajax requisitation for the url use default codification "UTF-8" as response.
I need use "ISO-8859-1" to support this characters.
I tried change the codification of the file and also inclue @CHARSET "ISO-8859-1" but without success.
So, I would like know if there are some option that I can say to request that the response is in codification ISO-8859-1, instead to UTF-8?
Something like this:
[code]
"oLanguage": {
"sUrl": {
"url": "config/datatable/pt_br.txt",
"codification": "ISO-8859-1"
}
}
[/code]

For now, I resolved this problem changing the file "pt_br.txt" to and "pt_br.php" and placing the ph header() function at the beginning of the file pt_br.php.
This way:

[code]
// initialization of the table
...
"oLanguage": {
"sUrl": "config/datatable/pt_br.php"
}
...
[/code]


[code]
// File "pt_br.php"
<?php
header("Content-Type: text/html; charset=ISO-8859-1", true);
?>
{
"oAria": {
"sSortAscending": " - clique para ordenar ascendente",
"sSortDescending": " - clique para ordenar descendente"
},
"oPaginate": {
"sFirst": "Primeira página",
"sPrevious": "Página anterior",
"sNext": "Próxima página",
"sLast": "Última página"
},
"sEmptyTable": "Nenhum registro encontrado",
"sInfo": "Exibindo de _START_ até _END_ de _TOTAL_ registros",
"sInfoEmpty": "Nenhum registro para exibir",
"sInfoFiltered": " (filtrado de _MAX_ registros)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"sLengthMenu": "Exibir _MENU_ registros por página",
"sLoadingRecords": "Por favor aguarde - carregando...",
"sProcessing": "Processando...",
"sSearch": "Filtrar:",
"sUrl": "",
"sZeroRecords": "Nenhum registro para exibir"
}
[/code]

Thank you.

Replies

  • allanallan Posts: 63,262Questions: 1Answers: 10,423 Site admin
    I don't quite understand why you can't use UTF-8? It has these characters in it as well. However, likely what you need to do is add a charset attribute to the Javascript tag to tell it what character set it should be working with.

    Allan
This discussion has been closed.