View Issue Details

IDProjectCategoryView StatusLast Update
0038898pas2jsrtlpublic2021-05-21 12:15
ReporterYuri Serebrennikov Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Summary0038898: TBinaryObjectReader.ReadString
DescriptionI use https://github.com/pascaldragon/Pas2JS_Widget
If you set the Cyrillic text in design mode, then it is displayed incorrectly.
If lfm file contains Cyrillic symbols, then this is a problem

i have debugged this problem and see in the classess.pas next code

function TBinaryObjectReader.ReadString(StringType: TValueType): String;
...
for I:=1 to Length(Result) do
    begin
    FStream.ReadbufferData(C); // <--- read symbol
    Result[i]:=C; // <-- assigned incorrect symbol
    end;
...

It seems to me that there are problems with reading the property value.


Additional InformationMore details i write here
https://github.com/pascaldragon/Pas2JS_Widget/issues/22
TagsNo tags attached.
Fixed in Revision
Attached Files

Activities

Yuri Serebrennikov

2021-05-15 18:03

reporter   ~0130903

demo.zip (107,935 bytes)

Yuri Serebrennikov

2021-05-15 18:06

reporter   ~0130904

demo_compiled.zip (453,925 bytes)

Michael Van Canneyt

2021-05-15 18:48

administrator   ~0130905

The strings are expected to be in UTF16 format. If they are not, then that is the problem.

Yuri Serebrennikov

2021-05-15 19:09

reporter   ~0130906

Lazarus create *.lfm files in UTF8 format.

henrique

2021-05-21 11:38

reporter   ~0130986

To resolve this problem, you need to declare the TextDecoder class https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder.

And in the commented snippet create such a class and decode the text for what you want.

Michael Van Canneyt

2021-05-21 12:15

administrator   ~0130987

This should normally be handled by TEncoding, it's on my todo list to implement this on top of TextDecoder.

Issue History

Date Modified Username Field Change
2021-05-15 18:00 Yuri Serebrennikov New Issue
2021-05-15 18:03 Yuri Serebrennikov Note Added: 0130903
2021-05-15 18:03 Yuri Serebrennikov File Added: demo.zip
2021-05-15 18:06 Yuri Serebrennikov Note Added: 0130904
2021-05-15 18:06 Yuri Serebrennikov File Added: demo_compiled.zip
2021-05-15 18:48 Michael Van Canneyt Note Added: 0130905
2021-05-15 19:09 Yuri Serebrennikov Note Added: 0130906
2021-05-21 11:38 henrique Note Added: 0130986
2021-05-21 12:15 Michael Van Canneyt Note Added: 0130987