Hi! I've encountered with wrong iconv work. root at timbsd:~ # uname -a FreeBSD timbsd 10.0-RELEASE-p3 FreeBSD 10.0-RELEASE-p3 #0: Tue May 13 18:31:10 UTC 2014 root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 root at timbsd:~ # locale LANGLC_CTYPE=ru_RU.UTF-8 LC_COLLATE="C" LC_TIME="C" LC_NUMERIC="C" LC_MONETARY="C" LC_MESSAGES="C" LC_ALL I have file with russian content. root at timbsd:~ # cat /tmp/delete_it ?????-?? ????? ?? ???????. Some text on russian ??? ???????. Some more. And I wanted to try to convert it to ISO. root at timbsd:~ # /usr/bin/iconv -t ISO-8859-15 /tmp/delete_it ?????-?? ????? ?? ???????. Some text on russian ??? ???????. Some more. iconv: warning: invalid characters: 31 root at timbsd:~ # echo $? 0 Why exit code is 0? Base iconv didn't manage to convert strings so exit code should be more than 0. That's really bad! converters/libiconv from ports works better in this case! See: root at timbsd:~ # /usr/local/bin/iconv -t ISO-8859-15 /tmp/delete_it /usr/local/bin/iconv: /tmp/delete_it:1:0: cannot convert root at timbsd:~ # echo $? 1 I tried it on FreeBSD 11-CURRENT and base iconv doesn't have such problem there. So I hope that suitable fixes will be MFCd to 10-STABLE.
I've just tried 10-STABLE r266571. Same story like in 10-RELEASE. 2014-05-20 16:04 GMT+04:00 Pavel Timofeev <timp87 at gmail.com>:> Hi! > > I've encountered with wrong iconv work. > > root at timbsd:~ # uname -a > FreeBSD timbsd 10.0-RELEASE-p3 FreeBSD 10.0-RELEASE-p3 #0: Tue May 13 > 18:31:10 UTC 2014 > root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 > > root at timbsd:~ # locale > LANG> LC_CTYPE=ru_RU.UTF-8 > LC_COLLATE="C" > LC_TIME="C" > LC_NUMERIC="C" > LC_MONETARY="C" > LC_MESSAGES="C" > LC_ALL> > I have file with russian content. > root at timbsd:~ # cat /tmp/delete_it > ?????-?? ????? ?? ???????. Some text on russian > > ??? ???????. Some more. > > > And I wanted to try to convert it to ISO. > root at timbsd:~ # /usr/bin/iconv -t ISO-8859-15 /tmp/delete_it > ?????-?? ????? ?? ???????. Some text on russian > > ??? ???????. Some more. > > iconv: warning: invalid characters: 31 > > root at timbsd:~ # echo $? > 0 > > > Why exit code is 0? Base iconv didn't manage to convert strings so > exit code should be more than 0. That's really bad! > > > converters/libiconv from ports works better in this case! > See: > root at timbsd:~ # /usr/local/bin/iconv -t ISO-8859-15 /tmp/delete_it > /usr/local/bin/iconv: /tmp/delete_it:1:0: cannot convert > root at timbsd:~ # echo $? > 1 > > I tried it on FreeBSD 11-CURRENT and base iconv doesn't have such problem there. > So I hope that suitable fixes will be MFCd to 10-STABLE.
On Tue, 20 May 2014 16:04:21 +0400 Pavel Timofeev wrote:> Hi! > > I've encountered with wrong iconv work. > > root at timbsd:~ # uname -a > FreeBSD timbsd 10.0-RELEASE-p3 FreeBSD 10.0-RELEASE-p3 #0: Tue May 13 > 18:31:10 UTC 2014 > root at amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 > > root at timbsd:~ # locale > LANG> LC_CTYPE=ru_RU.UTF-8 > LC_COLLATE="C" > LC_TIME="C" > LC_NUMERIC="C" > LC_MONETARY="C" > LC_MESSAGES="C" > LC_ALL> > I have file with russian content. > root at timbsd:~ # cat /tmp/delete_it > ?????-?? ????? ?? ???????. Some text on russian > > ??? ???????. Some more. > > > And I wanted to try to convert it to ISO. > root at timbsd:~ # /usr/bin/iconv -t ISO-8859-15 /tmp/delete_it > ?????-?? ????? ?? ???????. Some text on russian > > ??? ???????. Some more. > > iconv: warning: invalid characters: 31 > > root at timbsd:~ # echo $? > 0 > > > Why exit code is 0? Base iconv didn't manage to convert strings so > exit code should be more than 0. That's really bad! > > > converters/libiconv from ports works better in this case! > See: > root at timbsd:~ # /usr/local/bin/iconv -t ISO-8859-15 /tmp/delete_it > /usr/local/bin/iconv: /tmp/delete_it:1:0: cannot convert > root at timbsd:~ # echo $? > 1 > > I tried it on FreeBSD 11-CURRENT and base iconv doesn't have such problem there. > So I hope that suitable fixes will be MFCd to 10-STABLE.Actually, FreeBSD 11 doesn't return an error either. Can you try the attached patch? -------------- next part -------------- A non-text attachment was scrubbed... Name: iconv.patch Type: text/x-patch Size: 2541 bytes Desc: not available URL: <http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20140610/9a9ac85b/attachment.bin>