Hello TMS team,
I would like to report a character encoding issue in TMS WEB Core for Visual Studio Code on Linux(Lubuntu).
Environment:
- OS: Lubuntu
- Product: TMS WEB Core for Visual Studio Code
- Compiler: pas2js bundled with TMS WEB Core for VS Code
- The same source code works correctly on Windows version of TMS WEB Core for VS Code.
Problem:
UTF-8 Japanese characters are corrupted only inside asm blocks.
Japanese characters in normal Pascal code are generated correctly.
Sample source code:
procedure TForm1.WebButton1Click(Sender: TObject);
begin
WebButton1.Caption := 'Hello, 大石!';
asm
helloWorld("Hello, 大石!");
end;
end;
Generated JavaScript on Linux:
this.WebButton1Click = function (Sender) {
this.WebButton1.SetCaption("Hello, 大石!");
helloWorld("Hello, 大ç³!");
};
As shown above:
- The Pascal string used by
WebButton1.Captionis generated correctly:
Hello, 大石! - The string inside the
asmblock is corrupted:
Hello, 大ç³!
This means the .pas file itself seems to be read correctly as UTF-8, but the asm block processing path appears to handle UTF-8 characters incorrectly on Linux.
This issue also affects Japanese JavaScript function names inside asm blocks.
For example:
asm
こんにちは();
end;
is generated as:
ããã«ã¡ã¯();
This makes it impossible to reuse existing JavaScript programs that contain Japanese function names or Japanese string literals from asm blocks.
Workarounds such as replacing Japanese names with ASCII names, using Unicode escape sequences, or passing Pascal variables into asm blocks are not practical in our case, because we need to reuse already generated JavaScript programs as-is.
Could you please investigate whether the Linux version of TMS WEB Core for VS Code / pas2js has an encoding issue when processing asm blocks?
Expected behavior:
UTF-8 characters inside asm blocks should be preserved in the generated JavaScript, the same as normal Pascal string literals and the same as the Windows version.
Actual behavior:
UTF-8 characters inside asm blocks are converted incorrectly, apparently as if UTF-8 bytes were interpreted as Latin-1 / Windows-1252.
Thank you.
Project1.js (1.9 MB)
Unit1.pas (609 Bytes)