X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id D1171D1B46D for ; Tue, 9 Dec 2003 09:00:26 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 88000-05 for ; Tue, 9 Dec 2003 04:59:56 -0400 (AST) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id E4A8CD1B454 for ; Tue, 9 Dec 2003 04:59:53 -0400 (AST) Received: from myrealbox.com glaesema@smtp-send.myrealbox.com [61.115.206.98] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 3.46 $ on Novell NetWare; Tue, 09 Dec 2003 01:59:53 -0700 Date: Tue, 9 Dec 2003 17:59:50 +0900 Subject: Re: Unicode, php and postgresql Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Mime-Version: 1.0 (Apple Message framework v553) Cc: pgsql-php@postgresql.org To: Didier Bretin From: Michael Glaesemann In-Reply-To: <3FD5891A.8020708@informactis.com> Message-Id: <0BC6CE32-2A26-11D8-AAF1-0005029FC1A7@myrealbox.com> Content-Transfer-Encoding: quoted-printable X-Mailer: Apple Mail (2.553) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/10 X-Sequence-Number: 2456 Hi Didier! On Tuesday, December 9, 2003, at 05:34 PM, Didier Bretin wrote: > Hi, > > I try to install a 7.4.0 + php for developping an application in=20 > unicode. > Apparently I have no problem ;). > > But I don't understand enough the documentation of php. My postgresql > server is configured in unicode, and my database is entirely in=20 > unicode. > In my php.ini file I set no mbstring variables. When I'm connecting to=20 > the > database, I SELECT the data and then I print them, with the charset > utf-8, to the browser and all the characters are correctly displayed. > > My question is : is it the right way I don't have to configure anything > in php for dealing with unicode :) ? In my (admittedly limited) experience with PHP 4, Unicode, and=20 PostgreSQL, you can go a long way with the setup you descibe, i.e., not=20 using multi-byte string functions. However, all I do is move info in=20 and out of the database: I'm not doing any fancy-pants parsing of the=20 data in PHP=97including data sanity checking (besides preventing SQL=20 insertion). I would *not* recommend doing it as I've done, though it=20 does work for me. It's something I'm working on rectifying in my own=20 code, and rather than have to fix it later, I'd recommend doing it=20 right the first time. The reason it works is that PHP (at least as of PHP4) is agnostic about=20 the strings. It just takes it from the database and hands them to your=20 code, not trying to read it, parse it, check it, anything unless you=20 explicitly do so in the code. Again, I don't recommend this (though I've been doing it myself)=20 because I don't believe you'll be able to do proper data=20 checking=97especially if you're using higher order (i.e., not ASCII) code= =20 points. For me, this means the Japanese that moves into my database is=20 completely unchecked, and like I said, that's Not Good. To do proper=20 checking of the Japanese, I'd need to use $mb_string functions. I'm interested in hearing other's opinions on this as well,=20 particularly if they think I'm wrong=97I can always learn something! hth Michael Glaesemann grzm myrealbox com