--Multipart_Thu_Sep_28_23:29:52_2000-1
Content-Type: text/plain; charset=ISO-2022-JP

立石です.

iconv-0.4.2についてですが,

./message.rb:254: warning: already initialized constant MOVE_MAIL
test.rb:8:in `iconv': bug?(output length  58) (Iconv::OutOfRange)
        from test.rb:8

とエラーがでるのは,iconvのバグだと考えてよいのでしょうか?
使用しているiconvはSolaris7または8のものです.て,この
エラーがでるのは次のものです.

require 'iconv'

text  ile.open('mail.rb').read
u  conv.iconv("UTF-8","KSC5601",q_decode(text)).join("")
e  conv.iconv("EUC-KR", "UTF-8", u).join("")
print e

ここで,q_decodeというのは次のように定義しています.

def q_decode(text)
  text.gsub(/[ \t]+(\r\n|\r|\n|$)/,'\1').
	gsub(/r\n|\r|\n)/,'').
	gsub(/\da-fA-F]{2})/){ $1.hex.chr }
end

問題のmail.rbというファイルですが,KSC-5601という文字コードと,
EUC-JPが混在しています.このファイルについては添付しておきます.

昨日からいくつか調べてわかったことを挙げておきます.

* Solarisのiconvコマンドでは変換できている.
* UTF8 -> EUC-KRの変換時にエラーがでている.
* エラーがでる直前(iconv呼造造iconv_convertのoutlenには
  -2が入っている.
* iconv_convertの中で,bufferのサイズを4096とかでかくとると
  大丈夫.同様に,もとの文字列長の4,5倍のバッファサイズを
  動的にとれるようにしておくとまず大丈夫.

また,何か分かればレポートします.m(_ _)m


--Multipart_Thu_Sep_28_23:29:52_2000-1
Content-Type: application/octet-stream; type=gzip
Content-Disposition: attachment; filename="mail.rb.gz"
Content-Transfer-Encoding: base64

H4sICHz00TkAA21haWwucmIAtRprb9pK9vNG6n8YkQ9JV03KKyG5qnvXj3HCvYBZDG2jtrIMmMRb
sLM2tI3u7X/fOWfG9tgYQ6puVDnO+LznvOZMj8nZP89ItJk+wcuLo2PS9+LYvfdi4geEBvdLP354
cfTiKPL+u/Ejj9Smbuxdtmuwtgrnm6WXYLw4IkQ1+t2BM1D7lMCP0jJITdHqiqkr2pWiUkWvK4ZK
4JfOlzq1DK+vdnsZnjtf+cG/Ht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