ODBC php Excel Encoding Issues -
i'm making odbc connection php excel file. when encounter characters "~", "^", "´" appear messed this:
mês -> m?s
formação -> forma??o
i'm doing following utf-8 treatment column names:
$con = odbc_connect($odbcname, $dbuser, $dbpassword) or die('failed'); //the set names utf8 doesn't work excel. //$try = odbc_exec($con, "set names utf8"); $rs = odbc_exec($con, utf8_encode($dbquery)) or die('erro no sql'); $intnumfield = odbc_num_fields($rs); for($i=1; $i<=$intnumfield;$i++){ $columns[] = utf8_decode(odbc_field_name($rs,$i)); }
the file saved web options -> encoding -> unicode (utf-8).
is there else should doing in php?
thank in advance!
incase stumbles same problem had, solved following way:
- in excel file change encoding western european (windows-1252 utf-8);
- in php convert windows-1252 utf-8 -> $value = iconv("windows-1252", "utf-8", $auxvar);
- value has correct encoding.
for reason encoding of utf-8 in excel wasn't being handled correctly.
Comments
Post a Comment