everything is set to use utf-8. though i've notice now, first time i call the getJSON, on $ (document).ready, the response comes fine, with the right chars. the problem happens whe i click a button that calls the method again, witch is meant to perform a search.
On 16 Jun, 19:23, James <james.gp....@gmail.com> wrote: > 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?- Ocultar texto citado - > > - Mostrar texto citado -