[Lazarus] Problem with non-ascii chars fpc-3.0.0 vs fpc-3.1.1 under Windows

zeljko zeljko at holobit.net
Fri Apr 29 09:53:09 CEST 2016


On 04/28/2016 02:26 PM, Bart wrote:
> Example with
> set zeljko=äëï
> Result of StringCodePage in sqaure brackets:
>
> GetEnvironmentVariableUtf8: zeljko = $C3 $A4 $C3 $AB $C3 $AF [0]
> GetEnvironmentVariable with UnicodeString: zeljko = $00E4 $00EB $00EF [1200]
> UTF16ToUTF8 on result of previous line: zeljko = $C3 $A4 $C3 $AB $C3 $AF [65001]
> GetAppConfigDirUtf8: .... [65001]
>
> As a workaround you may try to use the Unicode variant of
> GetEnvironmentVariable and convert it to Utf8 with UTF16ToUtf8().
> The resulting string (on my system) then has stringCodePage = CP_UTF8 again.

Thanks, that workaround works, but with 2.6.4 have another type of problem:
1.Home dir is C:\Users\Željko
2.DirectoryExistsUTF8, any file inside $HOME FileExistsUTF8 and other 
file routines from LazFileUtils works like a charm.
3.IniFiles - TMemIniFile uses UpdateFile, and of course eg. 
C:\Users\Željko\myinifile.ini fails to update because UpdateFile 
inifiles uses ForceDirectories() ...
4.I said ok, let's create it with:
  a) UTF8ToSys(AFileName) - does not work
  b) UTF8ToConsole(AFileName) - does not work
  c) UTF8ToAnsi(AFIleName) - does not work
  d) LConvEncoding.UTF8ToCp1250(AFIleName) WORKS

So, have I missed something about UTF8ToSys() and others in case of 
fpc-2.6.4 ?

NOTE: I'm talking about fpc-2.6.4 ! fpc-3.0.0 works correct in this case

zeljko





More information about the Lazarus mailing list