2017-05-15 12 views
1

'(110 111 101 204 136 108)のようなリストを"noël"のような文字列に変換しようとしています。文字列へのUTF-8バイト

(mapcar (lambda (c) (decode-char 'unicode c)) '(110 111 101 204 136 108))を使ってみましたが、入力と同じ(110 111 101 204 136 108)となりました。 (また、私はUTF-8のシングルバイトからUnicode文字をデコードする方法はありませんことを認識し、そのためには、間違いなく間違っている機能です。)

答えて

2

いくつかのオプション...

(with-temp-buffer 
    (set-buffer-multibyte nil) 
    (apply #'insert '(110 111 101 204 136 108)) 
    (decode-coding-region (point-min) (point-max) 'utf-8 t)) 

か:

(decode-coding-string 
(mapconcat #'byte-to-string '(110 111 101 204 136 108) "") 
'utf-8) 

以上の直接的:これらはすべての偉大な仕事

(string-as-multibyte 
    (apply #'unibyte-string '(110 111 101 204 136 108))) 
+0

、ありがとう! –

関連する問題