Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encoding problem. #22

Open
seryal opened this issue May 15, 2021 · 3 comments
Open

Encoding problem. #22

seryal opened this issue May 15, 2021 · 3 comments

Comments

@seryal
Copy link

seryal commented May 15, 2021

Problem for Linux and Windows.
If you set the Cyrillic text in design mode, then it is displayed incorrectly.
Image
image

If Caption set in Runtime mode, it's ok.

procedure TWForm1.WButton1Click(Sender: TObject);
begin
  WLabel1.Caption:= 'HELLO = ПРИВЕТ';
end;

PS: Another languages too have problem.
HELLO = ПРИВЕТ = 你好

@seryal
Copy link
Author

seryal commented May 15, 2021

Read string from lfm file Classes.pas Line: 6593

function TBinaryObjectReader.ReadString(StringType: TValueType): String;
var
  i: Integer;
  C : Char;

begin
  Result:='';
  if StringType<>vaString then
    Raise EFilerError.Create('Invalid string type passed to ReadString');
  i:=ReadDWord;
  SetLength(Result, i);
  for I:=1 to Length(Result) do
    begin
    FStream.ReadbufferData(C); // <--- read symbol
    Result[i]:=C; // <-- assigned incorrect symbol
    end;
end;       

@seryal
Copy link
Author

seryal commented May 15, 2021

https://bugs.freepascal.org/view.php?id=38898

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

But Lazarus create *.lfm files in UTF8 format

@JanuszChmiel
Copy link

Unfortunately, setting The encoding to UTF16 LE or to UTF16 B causes Lazarus that it refuse to load .lfm form which have been stored by using this encoding type. I will try to use Akelpad and I will try to find UTF16 without LE or B letters in its encoding type name, but if it will not support it, we will have to only dream about easy drag and drop GUI creation tool for international characters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants