Commit 306cef4b49fa20b3ed2031261988b8bf80320080

Authored by Edmar Moretti
1 parent 16814a12

correção na codificação de caracteres

Showing 1 changed file with 8 additions and 3 deletions   Show diff stats
kml.php
... ... @@ -42,10 +42,14 @@ error_reporting(0);
42 42 include_once ("classesphp/carrega_ext.php");
43 43 include_once ("classesphp/classe_menutemas.php");
44 44 include_once ("ms_configura.php");
  45 +include_once ("admin/php/conexao.php");
  46 +$encoding = "ISO-8859-1";
  47 +if($convUTF == true)
  48 +{$encoding = "UTF-8";}
45 49 if(!isset($idioma))
46 50 {$idioma = "pt";}
47 51 echo header("Content-type: application/xml");
48   -echo '<?xml version="1.0" encoding="UTF-8"?>';
  52 +echo '<?xml version="1.0" encoding="'.$encoding.'"?>';
49 53 echo "<kml xmlns='http://earth.google.com/kml/2.2'>\n";
50 54 //
51 55 //pega os endereços para compor a url de chamada do gerador de web services
... ... @@ -287,7 +291,8 @@ function kml_networklink($nome,$fonte,$legenda,$desc,$href)
287 291 }
288 292 function kml_converteTexto($i)
289 293 {
290   - $encoding = mb_detect_encoding($i, 'UTF-8, UTF-7, ASCII, ISO-8859-1');
291   - return mb_convert_encoding($i,"UTF-8",$encoding);
  294 + global $encoding;
  295 + $encodingatual = mb_detect_encoding($i, 'UTF-8, UTF-7, ASCII, ISO-8859-1');
  296 + return mb_convert_encoding($i,$encoding,$encodingatual);
292 297 }
293 298 ?>
294 299 \ No newline at end of file
... ...