[Glass] Encoding classes name

Dale Henrichs dale.henrichs at gemtalksystems.com
Mon Aug 12 14:12:32 PDT 2019


On 8/12/19 9:38 AM, BrunoBB via Glass wrote:
> Hi,
>
> Why in GS (3.4.1) there is Utf8 class but no Utf7, Utf16, or Utf32 ?

In 3.4.3 and 3.5 we have added support for Utf16. Utf8 and Utf16 cover 
nearly all of common encoding use cases[1][2]. We added Utf16 support 
mainly because Windows uses Utf16 encoding in it's C API.

[1] https://en.wikipedia.org/wiki/UTF-16
[2] https://en.wikipedia.org/wiki/Comparison_of_Unicode_encodings
>
> But rather Unicode7, Unicode16 and Unicode32.

These three classes use fixed width character representations in memory 
(1 byte, 2 bytes and 4 bytes respectively) for efficient storage and 
efficient character access (i.e. using #at:). Unicode16 strings are 
_not_ stored in memory using Utf16 encoding, and so on ... Unicode7 maps 
to the 7 bit ASCII character set (code points <= 127), Unicode16 maps to 
characters with code points <= 65535, and Unicode32 covers characters 
with code points > 65535 ...

To put it another way, when you send #asString to a Utf8 instance you 
may end up with a Unicode7, Unicode16, or Unicode32 instance depending 
upon the size of the largest code point of the characters in the string ...

Does this answer your question?

Dale

>
> regards,
> bruno
>
>
>
>
> --
> Sent from: http://forum.world.st/GLASS-f1460844.html
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> https://lists.gemtalksystems.com/mailman/listinfo/glass


More information about the Glass mailing list