You are not logged in.
Pages: 1
I found a problem on localized Windors - in case Exception text contains non-english characters it's logged with wrong codepage (broken text from user POW). My actual excaption comes from OleDB ("Class not registeder" in russian), but the simple program to reproduce is
program Project1;
uses
sysutils, SynLog;
begin
TSynLog.Family.Level := LOG_VERBOSE;
try
raise Exception.create('ошибка');
finally
end;
end.
I expect string "ошибка" in UTF8 encoding inside logs but instead got abracadabra.
Not shure I'm fix this correctly in #182 pull request - @ab - please review a pull request
Last edited by mpv (2019-04-02 11:56:32)
Offline
On windows with cyrilic localization
TSynAnsiConvert.Engine(0) = TSynAnsiFixedWitdh(1251) = TSynAnsiConvert.Engine(GetACP); // GetACP == 1251
But I made another attempt to fix. It based on fact what for fpc > 3 string = utf8 string as described in FPC WiKi.
May be 0a08e1c commit is more correct?
Last edited by mpv (2019-04-09 20:50:54)
Offline
What could be wrong with:
procedure InitSynCommonsConversionTables;
....
{$ifdef FPC}
{$ifdef ISFPC27}
{$ifndef MSWINDOWS}
GetACP := CP_UTF8; // hardwire string=AnsiString to UTF-8 encoding on any POSIX system
{$endif MSWINDOWS}
SetMultiByteConversionCodePage(CP_UTF8);
SetMultiByteRTLFileSystemCodePage(CP_UTF8);
{$endif ISFPC27}
{$endif FPC}
Offline
Everything is OK for in InitSynCommonsConversionTables under Unix even if
{$ifndef MSWINDOWS}
GetACP := GetSystemCodePage;
{$endif MSWINDOWS}
My problem is under Windows, where GetACP is a function from kernel32 and in case of cyrilic windows localization it return 1251
BTW I made another patch for SynLog to write environment variables values to log using UTF8 encoding pull #189
Current implementation log unicode variables values in OEM encoding (as returned by GetEnvironmentStringsA) and it's become unreadable on other computers, because we even don't know what code page is set as console code page on the log source machine. For example on cyrilic windows it logged as CP866 encoded
Last edited by mpv (2019-04-22 07:38:42)
Offline
Pages: 1