【问题标题】:Getting Data from Vertica with PHP with wrong Encoding使用错误编码的 PHP 从 Vertica 获取数据
【发布时间】:2016-10-09 22:53:10
【问题描述】:

我正在尝试使用 php odbc_connect 从 Vertica DB 获取数据,但我遇到了俄文文本问题,例如,我没有获取此文本 Уютная,而是得到了 \x1A\x1A\x1A\x1A\x1A\x1A

这是我的 DNS 连接字符串:

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

这是我的 /etc/vertica.ini 文件(应用在 debian Jessie 中运行):

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

我正在使用 Vertica ODBC 驱动程序 7.2.2-0

知道如何解决吗?

谢谢!

【问题讨论】:

    标签: php character-encoding odbc vertica


    【解决方案1】:

    我找到的临时解决方案是使用 URI_PERCENT_ENCODE 函数(vertica sql 函数)包装该字段,然后在 php 中执行 urldecode。

    stackoverflow

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-04
      • 2021-12-31
      • 2016-12-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多