Re: character encoding problem

Pascal Bourguignon <[email protected]> Wed, 15 Jan 2020 20:52:51 +0100
Newsgroups gmane.lisp.clisp.general
Message-ID <[email protected]>

> On 15 Jan 2020, at 19:52, Don Cohen <[email protected]> wrote:
> 
> 
> 
> (code-char #xd83c)
> #\UD83C

This is not a valid unicode character codepoint.

https://www.fileformat.info/info/unicode/char/d83c/index.htm <https://www.fileformat.info/info/unicode/char/d83c/index.htm>



> (setf str (make-string 1 :initial-element *))
> "\355\240\274"
> 
> (EXT:CONVERT-STRING-TO-BYTES * charset:utf-8)
> #(237 160 188)
> 
> (EXT:CONVERT-STRING-from-BYTES * charset:utf-8)
> 
> *** - EXT:CONVERT-STRING-FROM-BYTES: Invalid byte sequence #xED #xA0 #xBC in
>      CHARSET:UTF-8 conversion
> 
> What's illegal about this byte sequence?  
> It seems to be the right one for #\UD83C.

utf-8 is able to encode all the codepoints between 0 and 1,112,063, but if you encode an invalid codepoint, you should not be surprised if a system cannot convert it into a unicode character!


-- 
__Pascal J. Bourguignon__





_______________________________________________
clisp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-list