[英]Oracle OCI8 PHP Debian Encoding error
i'm despaired of the encoding stuff using a debian 8 server with Instantclient 12.2, php 5.6 and oci8(2.0.12). 我对使用带有Instantclient 12.2,php 5.6和oci8(2.0.12)的debian 8服务器的编码感到失望。
I had encoding issues in the php sites itself which i solved by setting the php encoding to ISO-8859-1
in php.ini
. 我在php网站本身中存在编码问题,可以ISO-8859-1
在php.ini
中将php编码设置为ISO-8859-1
来解决。 -> So encoding, including all european chars, works for php. ->因此,编码(包括所有欧洲字符)都适用于php。
Now my problem is that the data I retrieve from our oracle12c database isn't encoded correctly. 现在我的问题是,我从oracle12c数据库检索的数据编码不正确。 So i get 所以我得到
a for ä
o for ö
u for ü
? for ß
When saving from php to Database, the same thing happens. 从php保存到数据库时,会发生同样的事情。
in sqlplus64 client the data is encoded correctly so i guess it has something to do with oci8. 在sqlplus64客户端中,数据已正确编码,所以我想它与oci8有关。
What i tried: 我试过的
I already set the NLS_LANG
parameter to GERMAN_GERMANY.WE8ISO8859P1
and GERMAN_GERMANY.UTF-8
, tried to give oci_connect()
a charset manually, tried all encoding options for apache2.conf
and php.ini
, tried to overwrite eventually loaded configs through .htaccess
file and stuff. 我已经将NLS_LANG
参数设置为GERMAN_GERMANY.WE8ISO8859P1
和GERMAN_GERMANY.UTF-8
,尝试手动给oci_connect()
一个字符集,尝试了apache2.conf
和php.ini
所有编码选项,试图覆盖通过.htaccess
文件最终加载的配置和东西。 But none of that worked. 但是,这些都不起作用。
Maybe someone knows a way out? 也许有人知道出路?
I solved it with 我解决了
putenv("NLS_LANG=GERMAN_GERMANY.WE8ISO8859P1");
before oci_connect()
在oci_connect()
之前
I have absolutely no idea why this is working but I guess the apache can't access the parameters i set via /etc/profile
file 我完全不知道为什么这行得通,但是我想apache无法访问我通过/etc/profile
文件设置的参数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.