Closed totyaxy closed 1 year ago
Hi,
Just a hint, these are better ways to check your CodePage using Lazarus:
Writeln('Console output codepage: ', GetTextCodePage(Output));
Writeln('System codepage: ', DefaultSystemCodePage);
I think Test13
will fail in the test13-Ansi.json
part because this file content will be read using your CP (1250) and them compared to Utf8ToAnsi('ãçüö')
, which was intended to be a CP 1252 string.
To check this diagnostic, please comment the following lines and run the test project again.
// M.LoadFromFile('test13-Ansi.json', false);
// Result := Result and (M['ansi'].AsString = Utf8ToAnsi('ãçüö'));
I think the UTF-8 parts from Test13
will be fine.
Also, I've been studying and to make this test CodePage agnostic I should use functions like CP1252ToUTF8()
from LazUtils. Maybe I'll give it a try latter.
Regards,
Hi!
Result #1 (as I wrote before): Console output codepage: 852 System codepage: 1250
Result #2 All tests PASSED
Thank you!
Hi again!
I read what you wrote, then if I change this line: uses ... LConvEncoding,
Result := Result and (M['ansi'].AsString = Utf8ToAnsi('ãçüö')); to: Result := Result and (M['ansi'].AsString = UTF8ToCP1252('ãçüö'));
BUT #1 test failed: [FAIL] Test 09: escapes
I think something conflict with the LConvEncoding unit.
...and YES!
Change this line in test #09: SRef := Utf8ToAnsi('aBçdç'); to SRef := UTF8ToCP1252('aBçdç');
then: All tests PASSED
My windows codepage:
** Command line: CHCP: Active code page: 852
** Power shell: Get-WinSystemLocale: LCID Name DisplayName 1038 hu-HU magyar (magyarországi)
** Wiki: https://en.wikipedia.org/wiki/Windows-1250 My country is Hungary.