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:

  1. in excel file change encoding western european (windows-1252 utf-8);
  2. in php convert windows-1252 utf-8 -> $value = iconv("windows-1252", "utf-8", $auxvar);
  3. value has correct encoding.

for reason encoding of utf-8 in excel wasn't being handled correctly.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -