|
|
Question : How to tie unicode db/php and apache correctly?
|
|
Hello,
The situation: - PostgreSQL 7.3 database with encoding=Unicode - PHP 4.3.2 - ISO-8859-1 php files in a standard Linux filesys (a php webapp, called Tutos (www.tutos.org)) - Apache 1.3.28
What I want: - to be able to put data from web in db and get it from db to web correctly (preferrably UTF-8).
What have I done:
- set httpd.conf AddDefaultCharset utf-8 - set php.ini: default_charset=utf-8
What is wrong:
- static html pages come in utf-8, but php pages still come in ISO-8859-1 charset (as shown by Content-type: header); - if I use chars outside the normal ASCII range in a query to database via the php webapp, I get no results (but this may be due to the webapp problems); - if I use chars outside the normal ASCII range and before that reset the char encoding of the page to UTF manually, I may get an error report by Tutos on the type of: Exec Resource id #40|DBerror: POSTGRES: ERROR: Invalid UNICODE character sequence found (0xe4ab6c)
If I let the pages remain in ISO-8859-1, then everything works, more or less, but the entries in database have entities instead of Unicode chars, ala: charcode; and this means I can't get proper sorting in db, and I am afraid I might have problems later, if I try to interface db with other front-ends.
The question is whether there is anything I can do in this particular case, and what are the general guidelines for working with unicode dbs with web (webserver settings/ engine)?
If you have a substantial answer to this, I am more than willing to give additional points.
|
Answer : How to tie unicode db/php and apache correctly?
|
|
pg_exec($db,"set client_encoding='unicode'");
sorry I am just guessing here
|
|
|
|
|