[fpc-pascal] Parse unicode scalar

Hairy Pixels genericptr at gmail.com
Sun Jul 2 15:30:36 CEST 2023


I'm interested in parsing unicode scalars (I think they're called) to byte sized values but I'm not sure where to start. First thing I did was choose the unicode scalar U+1F496 (💖).

Next I cheated and ask ChatGPT. :) Amazingly from my question it was able to tell me the scaler is comprised of these 4 bytes:

 240 159 146 150

I was able to correctly concatenate these characters and writeln printed the correct character.

var
	s: String;
begin
s := char(240)+char(159)+char(146)+char(150);
writeln(s);
end.

The question is, how was 1F496 decomposed into 4 bytes? 

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list