Here's the info I could gather about character set support and the ways to
set the desired character set using PHP:
- mysqli_* - SET NAMES after connecting or mysqli::set_charset()
- oci_* - oci_connect() $charset parameter
- pdo_mysql - SET NAMES after connecting or $config['driver_options'][
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES ...')
- pdo_pgsql - SET NAMES after connecting
- pdo_oracle - using the 'charset' part of the dsn
- pdo_firebird - SET NAMES after connecting
- sqlite - does not support client charset; uses UTF8 internally
- mssql - only uses unicode (not sure about this)
- db2 - ??? automatically converts data, db must be configured to
use correct charset
- ibase_* (firebird) - ibase_connect() $charset parameter
So it seems the most common sollution is to use 'SET NAMES' for pdo_* (with
the exception of pdo_oracle which sets the charset in the dsn) and to use
mysqli::set_charset() and the oci_connect() $charset parameter for mysqli
and oci interfaces.
Perhaps Simon Mundy can help us with more information on this issue (I added
him to the CC: )
I have been working on a patch for this feature, too. I already implemented
and tested the feature for Mysqli, Oracle, PDO_Mysql and PDO_Pgsql adapters,
and I will post the patch later today on the ZF issue page (
http://framework.zend.com/issues/browse/ZF-1541).
Regards,
Sorin Stoiana
On 8/5/08 2:39 AM, "Wil Sinclair" <wil@zend.com> wrote:
> Sorry, Bill is right. Simon Mundy has been working on this feature. I
> mistakenly added it to the RC1 release notes thinking he had already
> checked it in. I'm still waiting to hear from him on whether he'll have
> a commit ready for RC2.
> Thanks for reminding me to update the release notes!
>
> ,Wil
>
>> -----Original Message-----
>> From: Bill Karwin [mailto:bill@karwin.com]
>> Sent: Sunday, August 03, 2008 2:10 PM
>> To: fw-db@lists.zend.com
>> Subject: Re: [fw-db] ZF 1.6RC1, DB adapters and Character Set
>>
>>
>>
>>
>> Diabl0 wrote:
>>>
>>> There is info about built in support for character sets in ZF
> 1.6RC1,
>>> but can't find it, and any combinations with charset, characterset
>> etc
>>> doesnt work for me... How can i use this new (long awaited) feature
>> from
>>> ini files?
>>>
>>
>> Despite the fact that the ZF 1.6 announcement lists this feature, I
>> don't
>> think it has been implemented.
>>
>> http://framework.zend.com/issues/browse/ZF-1541 is the issue. If you
>> click
>> on "fisheye" to see associated code commits, there are none. This
>> doesn't
>> necessarily mean it wasn't implemented, but if it was, the commit
>> comment
>> didn't reference ZF-1541.
>>
>> I glanced through the Zend_Db_Adapter code briefly, but I didn't see
>> any
>> code that looked like it would support this feature (except in the
>> Pdo_Oci
>> adapter, but this is not implemented in a way that supports a common
>> interface for all adapters).
>>
>> I didn't check the incubator, only library and tests.
>>
>> Support for charset is more complicated than you would think, given
>> that it
>> should support all databases. See this thread:
>> http://www.nabble.com/About-charset%2C-should-be-in-options-array-or-
>> just-in-the-config-array.-td11993225.html
>>
>> Regards,
>> Bill Karwin
>> --
>> View this message in context: http://www.nabble.com/ZF-1.6RC1%2C-DB-
>> adapters-and-Character-Set-tp18768712p18802510.html
>> Sent from the Zend DB mailing list archive at Nabble.com.
>
没有评论:
发表评论