shiro #4628(2007/12/05 13:35 GMT) [ Scheme ] Rating0/0=0.00
1 2 3 4 5 6 7 8 9 10 11 12 13 14
(use gauche.charconv) ;; 1 (define (sjis2eucjp str) (ces-convert str 'sjis 'eucjp)) ;; 2 (define (sjis2eucjp-file infile outfile) (call-with-input-file infile (lambda (in) (call-with-output-file outfile (lambda (out) (copy-port in out)) :encoding 'eucjp)) :encoding 'sjis))
Rating0/0=0.00-0+
[ reply ]
shiro
#4628()
[
Scheme
]
Rating0/0=0.00
gosh> (ces-convert "いろは" 'utf-8 'sjis)
#*"\x82\xa2\x82\xeb\x82\xcd"
gosh> (sjis2eucjp #*"\x82\xa2\x82\xeb\x82\xcd")
#*"\xa4\xa4\xa4\xed\xa4\xcf"
gosh> (ces-convert #*"\xa4\xa4\xa4\xed\xa4\xcf" 'eucjp 'utf-8)
"いろは"
ただ、こういう扱いは意味的にすっきりしないので、将来はバイトベクタとして扱ってもらうようにするかもしれません。
Rating0/0=0.00-0+
[ reply ]