[fpc-pascal] Parse unicode scalar
Hairy Pixels
genericptr at gmail.com
Tue Jul 4 08:12:43 CEST 2023
> On Jul 4, 2023, at 12:38 PM, Nikolay Nikolov via fpc-pascal <fpc-pascal at lists.freepascal.org> wrote:
>
> For console apps that use the Unicode KVM video unit, I've introduced two functions for determining the display width of a Unicode string in the video unit:
>
> function ExtendedGraphemeClusterDisplayWidth(const EGC: UnicodeString): Integer;
> { Returns the number of display columns needed for the given extended grapheme cluster }
>
> function StringDisplayWidth(const S: UnicodeString): Integer;
> { Returns the number of display columns needed for the given string }
>
> Remember, the display width is different than the number of graphemes, due to East Asian double width characters.
>
> And these work with UnicodeString, which is UTF-16, not UTF-8. But Free Pascal can convert between the two.
is there an example snippet of how all this works? It's too level for newbies to understand. :)
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list