PHP ODBC连接到Oracle,没有UTF-8

I am having a problem to get UTF-8 support, when i try to connect to Oracle throught ODBC Data Source with PHP odbc_connect().

Also all of this is being done under 32bits. I am using oracle XE DB for testing and instaclient11_2 32bit drivers, ODBC Data source 32it +placed on WAMP32bit server.

Althougt i have same result with Oracle 12c DB and client Home 10g 32bit drivers.

@TODAY Tested this all with 64bit instanclient drivers, added ODBC 64DataSource on 64bit WAMP Server. Still no luck to display chars corretly...

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

<?php
$connect = odbc_connect("XEXDB", "username", "password");

$query = "SELECT col, 'čaļi' FROM TESST";

$result = odbc_exec($connect, $query);

while(odbc_fetch_row($result)){
  $name = odbc_result($result, 1);
  $surname = odbc_result($result, 2);
  echo "$name, $surname <br/>";
}

odbc_close($connect);

?>

Result i get from this code:

?A?IS, A?aA?i 
Gunt?rs Salts, A?aA?i 

But should be:

ĶAĶIS, čaļi
Guntārs Šalts, čaļi

I cant find how to write $dsn for odbc_connect() to force charset=utf-8, so far no luck to get working $conn_string with charset=utf-8.

Also tried to use utf8_encode() and utf8_decode()(using this was me being desperate).

Does anyone have had similar problem, or maybe someone have some suggestions i could try?

I found out, that return of ODBC and even ADO connections to ORACLE DB had same returns of ??? instead of UNICODE chars.

To fix this, I had to add NLS_LANG string value with your DB charset in WINDOWS REGISTRY under 32 un 64 bit location for ORACLE key.

HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE             --64 bits
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\ORACLE --32 bits

and for STRING VALUE(REG_SZ) and VALUE in my case:

"NLS_LANG"="LATVIAN_LATVIA.BLT8MSWIN1257" 

And for complete picture if someone still didn't get it, I added dump of reg file:

[HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE]
@=""
"NLS_LANG"="LATVIAN_LATVIA.BLT8MSWIN1257"