mixing charactersets
| From: | Juffermans, Jos | Date: | Thu, 21 Apr 2005 09:18:41 +0000 |
| Subject: | mixing charactersets | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-39245@lists.php.net to get a copy of this message | ||
Hi,
I have a script that needs to connect to two database. Unfortunately, one of
them uses US7ASCII encoding (similar to LATIN1) and the other one uses UTF-8
encoding.
Before I connect to the first one, I set these environment variables:
putenv("NLS_LANG=AMERICAN_AMERICA.US7ASCII");
putenv("NLS_CHARACTERSET=US7ASCII");
and before I connect to the second one, I set these environment variables:
putenv("NLS_LANG=AMERICAN_AMERICA.UTF8");
putenv("NLS_CHARACTERSET=UTF8");
I have noticed that once you have set the environment, it ignores (or seems
to ignore anyway) the second one. I have tried to set the environment each
time just before I connect and also just before I do a query, but that
doesn't make a difference.
If I don't set the characterset to US7ASCII before I retrieve data from the
first database, I get garbage data from the query. If I don't set the
characterset to UTF-8 before I store data to the second database, it stores
garbage.
How can I use those two databases in one script?
Jos