[dev] Default charset and utf-8 encoding

François Helly fhelly at bebop-design.net
Wed Sep 29 20:29:18 PDT 2004


Le 30 sept. 04, à 01:12, dev-request at lists.horde.org a écrit :

>
>>
>> Le 29 sept. 04, à 21:00, dev-request at lists.horde.org a écrit :
>>
>>>> I noticed that when I turn the default-charset to utf-8
>>>> (horde/config/nls.php)
>>>> the help xml files which are iso-8859-1 encoded are not converted
>>>> properly into the expected charset (utf-8).
>>>
>>> Don't fiddle with that setting unless you know what you are doing.
>>>
>>
>> I want my horde applications to output utf-8 encoded files.
>> Reason: the datas I have to output are multilingual (i.e. mixed
>> languages in the same string)
>
> This happens already automatically.

Yes it should.

But not on my install (horde 3 cvs 20040928) on
windows 2000 apache 1.3.31 + php 4.3.8
windows 2000  apache 2.0.49 + php 5.0.1
redHat 9 apache 1.3.29 + php 4.3.4

I got the iconv AND the mbstring ext in all configurations.
I run tests on MSIE 6 (windows) AND Safari (MacOSX), both have utf 
feature.

If I use  default-charset ISO-8859-1 (same as dist)
the output seems to be always ISO-8859-1 encoded.

But say If I'm wrong (am I sure of something?):
the output NLS::getCharset() is used in the header sent to browser 
(i.e. the charset used to encode the output document sent) and is the 
default charset of all the charset conversions managed by 
String::convertCharset().

I guess :
My problem is located in NLS::setLang()
called by the Registry.

NLS::getCharset() output UTF-8 before running NLS::setLang()
and after it always output ISO-8859-1 because of _cachedCharset
and default charset set to it.

It seems to be caused by the setLocale tests in NLS::setLang().
Btw, on windows (both php4 php5), the setLocale with fr_FR seems to 
work only with the abreviation 'fr',
not with 'fr_FR.UTF-8', neither with 'fr_FR', etc.
So the default charset is applied...

Say if I'm dreaming but the only way I found untill now to *always*
output utf-8 was to force the default charset to utf-8
(remenbering first steps of implementation of utf-8 in NLS, humm... 2 
years ago? :)














More information about the dev mailing list