apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko Čibej <br...@xbc.nu>
Subject Re: Misbehaviour of apr_os_locale_encoding on Windows
Date Tue, 13 Apr 2010 20:08:30 GMT
On 13.04.2010 20:47, Роман Донченко wrote:
> Branko Čibej <brane@xbc.nu> писал в своём письме Wed, 14 Apr
2010
> 00:29:23 +0500:
>
>> On 13.04.2010 20:21, Роман Донченко wrote:
>>> Branko Čibej <brane@xbc.nu> писал в своём письме Tue,
13 Apr 2010
>>> 23:34:21 +0500:
>>>
>>>> On 13.04.2010 19:19, William A. Rowe Jr. wrote:
>>>>> What is your opinion of the proposed patch to just this interface?
>>>>> It seems
>>>>> that aligning to the system LCID is very problematic for a
>>>>> multi-user OS,
>>>>> where you are on an eastern European codepage, and I'm on a western
>>>>> codepage.
>>>>> The files you are working with are likely different than mine.
>>>>> Changing to
>>>>> the systemwide codepage definitely seems invalid, notwithstanding
>>>>> the issues
>>>>> noted about apr_user_name_get().
>>
>>> Anyway, we're not ignoring the whole thread locale here — just the
>>> code page part. And here's another thought experiment: Notepad, by
>>> default, saves and reads files in the system codepage, regardless of
>>> what the user locale says. Makes sense to be compatible with Notepad,
>>> doesn't it? 8=] That, and apr_user_name_get, and all the ANSI versions
>>> of the WinAPI functions - you'd be hard-pressed to find a place where
>>> the user locale's code page is actually used. Well, maybe in projects
>>> that use APR. 8=]
>>
>> I was under the impression that Windows allowed each window of each
>> application to use a different input method and code page, hence the
>> assumption that the thread locale's code page is the correct one. Is
>> that not the case?
>
> The input method, AFAIK, is thread-specific, but it's largely
> irrelevant here. "Code page", on the other hand... An application can
> in principle use any code page it wants, but the ANSI WinAPI functions
> definitely use the system locale's ANSI codepage, a.k.a. CP_ACP,
> GetACP(), and GetLocaleInfo(LOCALE_SYSTEM_DEFAULT,
> LOCALE_IDEFAULTANSICODEPAGE). See the link in my first post (and try
> the Notepad experiment). Since the ANSI codepage is all the
> Unicode-unaware apps get, they naturally tend to produce and consume
> CP_ACP-flavoured text; and since Unicode-aware apps want to stay
> compatible with the unaware, they tend to do that, as well.

Hmmmm ... ok. I wonder what the thread CP is for then.

> This posting is provided AS-IS and represents my personal experience.
> No warranty implied. 8=]

Yah, right. :)

-- Brane

Mime
View raw message