[Pharo-project] About unicodeToMacRoman

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Thu Apr 2 14:38:01 EDT 2009


2009/4/1 Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>:
> Hello list,
>
> that's just a detail, but I do not much like Character>>unicodeToMacRoman.
>
> Why?
> Because a Character does not explicitely carry encoding information.
> On the contrary, Character are implicitely considered as unicode
> encoded in 99% of code.
>
> So, pretending a Character can change encoding is just a hack for a
> small portion of code...

Err...
For some leadingChar ~= 0, encoding IS NOT unicode.
Encoding is specified by leadingChar.

x := (1 << 22 + 16rE4) asCharacter.
x asUnicode hex.  -> 'FF29'
x charCode hex.  -> 'E4'
EncodedCharSet charsetAt: x leadingChar. -> JISX0208

Beware not to print such a Character, it might fail with never ending
notifier poping up

Nicolas




More information about the Pharo-dev mailing list