1

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 NAMES UTF-8" request on the database, but I can't find how to do this with ingres?

Thank you very much!

J4N
  • 19,480
  • 39
  • 187
  • 340

1 Answers1

1

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)

grantc
  • 1,703
  • 12
  • 13
  • The problem is that I can't change anything on the ingres database, it comes from an ERP database and it's another enterprise which manage it, I've no right on the database, it's why I was hopping that I can just set the client value to the UTF8 encoding. – J4N Sep 12 '11 at 05:17
  • Unfortunately you are out of luck unless you modify the cakephp interface to coerce the UTF-8 data to ISO-8859-1 and back again. In theory the driver could do this but it would create a dependency on external libraries such as ICU or iconv. – grantc Sep 12 '11 at 11:07
  • 1
    I'm starting to hate Ingres... For a DBMS which announce they were at the same level than oracle, they are even lower than mysql – J4N Sep 16 '11 at 05:45
  • You would have the same problem with Oracle as well. Depends how the instance is configured... I am not advocating Ingres here, but hating Ingres because someone configured it not to use UTF-8 is a bit harsh. MariaDB/MySQL tables must also be configured to "understand" UTF-8 ( http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-utf8.html ) . So the problem is strictly in the database administration, in this case. – DejanLekic May 30 '12 at 14:22