开发者

Ingres: how to read the database in a specified encoding in PHP?

I've to use CakePhp with ingres.

The problem is that I've to use UTF-8 in the website and the database is provided in ISO-8859-1.

So my question is, how to manage this charset problem?

On MySql I know I can run a "SET NAM开发者_C百科ES UTF-8" request on the database, but I can't find how to do this with ingres?

Thank you very much!


Unfortunately the encoding/character set is defined at a system level using the environment variable II_CHARSETxx. See the output from ingprenv to get your value. You can change it but you are likely to get data corruption. Your best bet to work with UTF-8 is to use N(VAR)CHAR, instead of VARCHAR and the PHP driver will assume that all data coming in is in in UTF-8 and convert to-from UTF-16. This conversion is controlled by the ini setting ingres.utf8 (see http://php.net/manual/en/ingres.configuration.php#ini.ingres.utf8)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜