Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why the SizeOf(Char) = 2 in Delphi2009+?

I am wondering: SizeOf(Char) = 2 in never Delphi versions, but this is not enough to store all integer mappings for characters defined in unicode table, right? (As far as I know there is more characters than 65536). So how this problem is solved?

Maybe two bytes are used to encode all characters from Basic Multilingual Plane (BMP)? But what happens with characters from outside the BMP?

Could someone sheed light on this?

Thanks.

like image 324
Wodzu Avatar asked Nov 04 '22 17:11

Wodzu


1 Answers

Strings outside BMP are encoded with surrogates, as in UTF-16.

like image 120
nneonneo Avatar answered Nov 15 '22 07:11

nneonneo