* Common Lisp : xmls & s-xml と日本語
xmls で日本語を出力するには、write-escaped を修正する。
例えば以下のような感じ。
s-xml の場合は print-string-xml に手を入れればいいと思う。
が、どの範囲をそのまま出力するようにするかが悩ましい。
UTF-8で出力することが前提ならなら ASCII 以上は全部でも良いとは思うけど、文字コード・文字集合辺りはよく分からないなあ。(上のはASCII以上全部になっているし)
update : 2008-03-11 (Tue) 03:03:30
例えば以下のような感じ。
(in-package :xmls) (defun write-escaped (string stream) "Writes string to stream with all character entities escaped." (coerce string 'simple-base-string) (when (eq stream t) (setf stream *standard-output*)) (loop for char across string for esc = (if (< (char-code char) (length *char-escapes*)) (svref *char-escapes* (char-code char)) (string char)) do (write-sequence esc stream)))ただ、xmls で出力した xml はあんまり見慣れない書き方になるみたいなので使わない気がする。
s-xml の場合は print-string-xml に手を入れればいいと思う。
が、どの範囲をそのまま出力するようにするかが悩ましい。
UTF-8で出力することが前提ならなら ASCII 以上は全部でも良いとは思うけど、文字コード・文字集合辺りはよく分からないなあ。(上のはASCII以上全部になっているし)
update : 2008-03-11 (Tue) 03:03:30