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?