creole
creole is a library for converting a string between multibyte and unicode character encodings.

creole supports SBCL and other unicode(UTF-8) supported implementations. (eg. clisp, Clozure CL)

※ creole is optimized for SBCL



Exported symbols:

Variable *DEFAULT-EXTERNAL-FORMAT*
 Default value is :UTF-8.

Variable *EXTERNAL-FORMAT*
 A list of avaiable external-format.

Function STRING-TO-OCTETS (string &key (external-format *default-external-format*) (start 0) (end (length string))

Function OCTETS-TO-STRING (octets &key (external-format *default-external-format*) (start 0) (end (length octets))

;;;;;;;;;;;;;;;;;;;;;
;;;; string => octets
(creole:string-to-octets "Common Lisp")
=> #(67 111 109 109 111 110 32 76 105 115 112)  ; default (= *default-external-format*) is UTF-8
   T                                            ; input string is legal

(creole:string-to-octets "漢字A" :external-format :ascii)
=> #(63 63 65) 
   NIL         ; input including illegal character

(creole:string-to-octets "漢字A" :external-format :euc-jp)
=> #(180 193 187 250 65)
   T

;;;;;;;;;;;;;;;;;;;;;;
;;;; octets => string
(creole:octets-to-string 
  (creole:string-to-octets "Common Lisp"))
=> "Common Lisp"
   T

(creole:octets-to-string
  (creole:string-to-octets "漢字A" :external-format :euc-jp)
  :external-format :ascii)
=> "????A"
   NIL     ; input including illegal octets as ASCII