[fpc-devel] natural unicode support for WinNT via UTF-8
ybxsoft at tut.by
Thu Apr 14 23:45:58 CEST 2005
If there were full unicode support (TCHAR analogue) the life under Win32 would be simpler $)
Two RTLs should be for Win32, one compiled for ANSI/DBCS and the other for
UNICODE UCS-2 (WinNT), where a special type,
say TUniString is AnsiString in the first version and
UnicodeString in the second version.
What do you think of it?
I need a unicode GUI and command line processing in my Win32 programms for
they deal with a number of languages and intended for WinNT/2k/XP
with natural unicode support.
When I say UNICODE support I don't mean automatic translation between 8-bit
and 16-bit strings but calling *W API functions and using Unicode strings in
parameters to file io, parameters etc. the rest functions like ToUTF8(), FromUTF8()
can be provided as a separate unit.
Under Linux the life is easier because one can set UTF-8 for system encoding
and use AnsiStrings or char* in their applications but under WinXX one
have to use wchar_t and *W variants of Win32 API functions :(
and maintain two versions of libraries...
Even better solution - to treat AnsiStrings as UTF-8 when UNICODE_UTF8 is defined, but convert UTF8 to WideString on system calls (Win API). But this can cause performance hits...
Though to treat AnsiStrings as UTF-8 is the best solution
regarding compatibility, i.e. no need to rewrite FCL etc. as
AnsiString or String types can be used to store UTF-8 strings.
As soon as I finish downloading FPC 1.9.8 sources I'll try to
edit system unit for Win32 to understand UNICODE_UTF8 define and
to build a unit using *W (widechar Win32 functions) and Utf8
conversion routines (MultiByteToUnicode() etc.)... So that
file/console IO and parameters (paramstr) functions deal with
Win32 API widechar functions and convert between UTF8 and UCS-2...
Does anybody work on this issue too? Please comment on it, maybe
there's already something in the sources that I am not aware of?
Yury mailto:ybxsoft at tut.by
More information about the fpc-devel