Encoding is not proper when query from Apache/PHP
Asked Answered
S

2

0

I have some problem with connection to my Vertica.
I use PHP and PDO ODBC driver (thrue unixODBC).
When I connect to Vertica via isql and select records from table all data are fine encoded - fields with UTF-8 (non ASCII symbols, for example cyrillic) correctly prints.
If connect from web with PHP script and execute same query that fields has some unicode characters like this \u001A\u001A\u001A\u001A
Each \u001A represent a one non ASCII symbol and can't be printed.

I found that this problem occurs only when you run a script from the web (web server is Apache2).
So if you run the script from the console, it's OK.
But if you do it from localhost/test.php, we get the issue.
It occurs on x32 and x64 versions of Vertica client drivers for Linux and Windows.
How does the Apache can influence the outcome results that we get from Vertica?

Samira answered 1/8, 2013 at 4:17 Comment(1)
This is definitely above my pay grade. I would highly recommend getting Vertica involved. It sounds like a bug in the driver which would require some debugging on their end. Not a beautiful answer for the site, but that's what I would do post-haste.Acrophobia
S
0

Needs to added locale setting directly to PHP code and everything start to work

setlocale(LC_ALL, 'en_US.UTF-8');
Samira answered 6/8, 2013 at 11:46 Comment(0)
G
0

Make sure you have DriverManagerEncoding=UTF-16 in your vertica.ini file. Of course maybe you need to try a different value (UTF-8 or UTF-32 maybe) but for me, it only worked with UTF-16. It seems to be completely independent of what encoding your client is using. I think unixODBC does some kind of conversion internally, and the Vertica driver has to produce whatever encoding the driver manager was expecting.

Gilkey answered 2/8, 2013 at 21:57 Comment(1)
I try all encodings for DriverManagerEncoding - no resuts. You can select data from Vertica with non ASCII symbol on your system from web? (Apache/PHP)Samira
S
0

Needs to added locale setting directly to PHP code and everything start to work

setlocale(LC_ALL, 'en_US.UTF-8');
Samira answered 6/8, 2013 at 11:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.