Now, what I was looking for, was a function which could convert a character to UTF-8.
I have written a small function myself which performs this task for a string, assuming bytevalues 0-255:
Code: Select all
(define (utf str)
(set 't 0)
(while (< t (length str))
(begin
(set 'x (nth t str))
(if (> (char x) 127)
(begin
(set 'b1 (+ (/ (& (char x) 192) 64) 192))
(set 'b2 (+ (& (char x) 63) 128))
(set-nth t str (append (char b1)(char b2)))
(inc 't)
)
)
(inc 't)
)
)
str)
(utf "Kein überraschung") -> "Kein überraschung"
How about that?