Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-11

In NeedRTLAnsi, can GetACP return CP_UTF8 on Windows?

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

cobines

Hello.

The code for Windows version of NeedRTLAnsi has:

FNeedRTLAnsi:=GetACPCP_UTF8;

Is it possible that CP_UTF8 will ever be returned by GetACP?

I know that CP_UTF8 exists on the list of codepages but I suspect it has only been added for use in functions like MultiByteToWideChar, SetConsoleOutputCP.

The MSDN says GetACP returns ANSI code page and CP_UTF8 is not an ANSI codepage. I have found an old page where in the comments an MS developers says GetACP does not support UTF-8.

http://blogs.msdn.com/b/michkap/archive/2007/05/11/2547703.aspx?PageIndex=1#comments

cobines

Reply by email

Felipe Monteiro de Carvalho
to cobines
cobines wrote
FNeedRTLAnsi:=GetACPCP_UTF8;

This is used by FileUtil in Windows for Windows 9x support

Is it possible that CP_UTF8 will ever be returned by GetACP?

I've never heard of a Windows localization where this occurs.

I know that CP_UTF8 exists on the list of codepages but I suspect it has only been added for use in functions like MultiByteToWideChar, SetConsoleOutputCP.

This is my understanding too.

Felipe Monteiro de Carvalho

Reply by email

cobines
to Felipe Monteiro de Carvalho

2011/11/8 Felipe Monteiro de Carvalho :

Show quoted text 14 lines
On Tue, Nov 8, 2011 at 9:50 PM, cobines wrote: > FNeedRTLAnsi:=GetACPCP_UTF8; This is used by FileUtil in Windows for Windows 9x support > Is it possible that CP_UTF8 will ever be returned by GetACP? I've never heard of a Windows localization where this occurs. > I know that CP_UTF8 exists on the list of codepages but I suspect it > has only been added for use in functions like MultiByteToWideChar, > SetConsoleOutputCP. This is my understanding too.

So can the implementation of NeedRTLAnsi on Windows be changed to return always True? Or is it needed to read the variable because it can be set by SetNeedRTLAnsi. Or at least GetACPCP_UTF8 might be exchanged to True.

cobines

Reply by email

Felipe Monteiro de Carvalho
to cobines
cobines wrote
So can the implementation of NeedRTLAnsi on Windows be changed to return always True?

Golden rule: If it is not broken, don't change it.

Felipe Monteiro de Carvalho

Reply by email