Re: DB/DB_DataObject and MySQL character sets
| From: | Justin Patrin | Date: | Wed, 15 Dec 2004 00:30:09 +0000 |
| Subject: | Re: DB/DB_DataObject and MySQL character sets | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16235@lists.php.net to get a copy of this message | ||
On Tue, 14 Dec 2004 16:26:58 -0800, Ken Restivo <ken@restivo.org> wrote:
> On Tue, Dec 14, 2004 at 09:13:29AM -0800, Justin Patrin wrote:
> > > default-character-set=cp1251
> > >
> > > in my.ini, but it didn't help me.
> > >
> >
> > Here's a quick hac for you. After including your ini file, get a DO
> > and set the charset.
> >
> > $do = DB_DataObject::factory('someTable');
> > $do->query('SET CHARACTER SET cp1251');
> >
>
> Does this need to be done in the initialisation of *every* DO?
>
> Or is there some way to set the character set via a static method, and have it apply globally?
>
You should only need to do this once for each connection, so at the
top of the script (or the beginning of your DB_DataObject usage).
> I haven't seen this problem yet, but my ISP just upgraded to MySQL 4.1, and I've
> already seen other weird problems in other areas, so I'm worried.
>
AHA! As another poster said, Mysql 4 is different than earlier
versions. Try changing your connect DSN to use mysqli instead of mysql
(note the extra i). If PHP doesn't have the mysqli extension
installed, tell your ISP you need it for Mysql 4.
--
Justin Patrin