From: nobu.nakada@... Date: 2002-03-18T15:51:08+09:00 Subject: [ruby-dev:16454] Re: ext/iconv does not work with iconv 2.0 (FreeBSD) (PR#273) なかだです。 At Fri, 15 Mar 2002 23:55:03 +0900 (JST), xm@xml-objects.com wrote: > Full_Name: Aristarkh A Zagorodnikov > Version: ruby 1.7.2 (2002-03-14) [i386-freebsd4.3] > OS: FreeBSD 4.3-STABLE > Submission from: (NULL) (80.80.104.3) > > > ext/iconv does not work with iconv 2.0 (FreeBSD), while works correctly with > iconv from GNU libc. > It fails on conversion of strings, which are more than 1024 bytes. > In this case, *inlen (in iconv_try()) is nonzero (iconv() returns when 1024th > character is converted), and error is not set (errno == EZERO). It seems that > this case should be interpreted as a E2BIG (i.e. process with next block). > FYI: string was a synthetic one (1025 '.' characters), source and target > encodings are 'iso-8859-1'. FreeBSDのiconv 2.0で、'iso-8859-1'から'iso-8859-1'へのiconv()で1024バ イトまでしか変換されないという報告があるんですが、これはFreeBSDのほう ではなにか報告されてないでしょうか。 の iconv-2.0/lib/converter.cを見ると、このnull_conv()が実際になにも変換さ れないときの処理を行っているようなんですが、*outbytesleftが足りないと きでも0を返してるだけなのがまずいような気がします。 | static size_t | null_conv(void *data, const unsigned char **inbuf, size_t *inbytesleft, | unsigned char **outbuf, size_t *outbytesleft) | { | if (inbuf && *inbuf && inbytesleft && *inbytesleft > 0 && outbuf | && *outbuf && outbytesleft && *outbytesleft > 0) { | size_t len = *inbytesleft < *outbytesleft ? *inbytesleft | : *outbytesleft; | bcopy(*inbuf, *outbuf, len); | *inbuf += len; | *inbytesleft -= len; | *outbuf += len; | *outbytesleft -= len; | } | return 0; | } また、unicode_conv()でもerrnoを設定するだけで-1を返していないところが あります。 -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦