It's a bug in the handling of the constant string
Summary
It's a bug in the handling of the constant string (the code that handles the constant value does not correctly handle the case of the string constant being a Unicode string constant unlike the code for expressions)
System Information
- Operating system: Windows
- Processor architecture: x86, x86-64
- Compiler version: All
- Device: Computer
Steps to reproduce
{$codepage utf8}
program project1;
var
ar: PChar = 'Ёжик';
begin
Writeln(strlen(ar)); //Error
Writeln(Length(Ar)); //Error
ar := 'Ёжик';
Writeln(strlen(ar)); //Ok
Writeln(Length(Ar)); //Ok
Readln;
end.
Example Project
What is the current bug behavior?
Incorrect getting pchar variable value. What is the expected (correct) behavior?
Relevant logs and/or screenshots
Possible fixes
Edited by Michael Van Canneyt