Make sure the page your Javascript is on is also also uses utf-8
content-type (e.g. in meta tags). Same for your PHP script.

On Jun 16, 1:45 am, Obi1 <gurreiro_fa...@yahoo.com.br> wrote:
> Hi,
>
> I'am having a bit of a problem with special chars in a getJSON
> response which is the result from php and smarty
>
> the file called by the getJSON is something like this:
> <?php
>    $callback = $_REQUEST["callback"];
>    {...}
>       Getting data from a wsdl using nusoap.
>    {...}
>    $smarty = new Smarty;
>    $smarty->compile_check = true;
>    $smarty->debugging = false;
>    $smarty->template_dir = $CFG->smartydirs . "/templates";
>    $smarty->compile_dir = $CFG->smartydirs . "/templates_c";
>    $smarty->config_dir = $CFG->smartydirs . "/configs";
>    {...}
>       assigning vars etc...
>    {...}
>    $html = $smarty->fetch("alojamentos/resultadoPesquisa.tpl");
>
>    $resposta = array(
>       "html"=>utf8_encode($html)
>    );
>
>    echo $callback . '('. json_encode($resposta) . ')';
> ?>
>
> some of the vars and text used in the smarty output as accents,
> ceddils, etc the problem is when i replace a div's innerHTML for the
> one on json.html those special chars appear like squares or chinese
> chars.
> how can this be fixed?

Reply via email to