On Sat, Oct 8, 2016 at 1:06 PM, Jens Axel Søgaard <jensa...@soegaard.net>
wrote:

> Hi All,
>
> The following interaction shows how the reader can be used to construct a
> surrogate character:
>
>     > (string-ref "\ud800\udc00" 0)
>     #\𐀀
>
> Given the two hexadecimal numbers d800 and dc00 how do I
> construct the surrogate character directly?
>
> /Jens Axel
>
>
I think you have to do the arithmetic yourself. Something like:

(define (utf-16-surrogate-pair->char hi lo)
  (integer->char
   (+ #x10000
      (arithmetic-shift (bitwise-and hi #x03ff) 10)
      (bitwise-and lo #x03ff))))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to