2017-05-15 6 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의 단일 바이트에서 유니 코드 문자를 해독 할 수있는 방법이 없다는 것을 인식하고, 그래서 확실히 잘못된 기능입니다.)

답변

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

, 감사합니다! –