[fpc-pascal] Parse unicode scalar
Hairy Pixels
genericptr at gmail.com
Tue Jul 4 06:56:59 CEST 2023
> On Jul 4, 2023, at 11:50 AM, Hairy Pixels <genericptr at gmail.com> wrote:
>
> You know you're right, with properly enclosed patterns you can capture everything inside and it works. You won't know if you had unicode in your string or not though but that depends on what's being parsed and if you care or not (I'm doing a TOML parser).
Sorry I'm still curious even though it's not my current problem :)
How can I make this program output the expected results:
w: widechar;
a: array of widechar;
begin
for w in 'abc🐻' do
a += [w];
// Outputs 7 instead of 4
writeln(length(a));
end;
The user doesn't know about unicode they just want to get an array of characters and not worry about all these little details. What can FPC do to solve this problem?
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list