简体   繁体   中英

Getting Data from Vertica with PHP with wrong Encoding

I'm trying to get data from Vertica DB using php odbc_connect, I have a problem with Russsian text, so for example instead of getting this text Уютная I got an \\x1A\\x1A\\x1A\\x1A\\x1A\\x1A

This is my DNS connection string:

 $dsn = "Driver=Vertica;Server={$host};Port={$port};Database={$database};";
 $this->connection = odbc_connect($dsn, $username, $password);

And this my /etc/vertica.ini file (app runs in debian Jessie):

[Driver]
DriverManagerEncoding=UTF-16
ODBCInstLib = /usr/lib/x86_64-linux-gnu/libodbcinst.so.1
ErrorMessagesPath=/opt/vertica
LogLevel=4
LogPath=/tmp

I'm using Vertica ODBC driver 7.2.2-0

Any idea how I can fix it?

Thank you !

Temporary solution I found is to wrap the field with URI_PERCENT_ENCODE function (vertica sql function) and in php you do a urldecode.

stackoverflow

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM