2009/11/15 Yongwei Wu <[email protected]>:
>
> Hi Bram and all,
>
> The help on iconv() writes:
>
> When the conversion fails an empty string is returned.
>
> In fact, I have not found a way to make the conversion fail.
>
> When a file containing the following text encoded in cp936 is read in
> Vim as euc-jp, Vim complains "[CONVERSION ERROR in line 1]":
>
> TVアニメ 宙のまにまに EDテーマ「星屑のサラウンド」/CooRie
>
> However, when one tries to get the failure from an iconv call, the
> error is never got:
>
> (:set encoding=utf-8)
> :echo iconv(iconv('TVアニメ 宙のまにまに
> EDテーマ「星屑のサラウンド」/CooRie','utf-8','cp936'),'euc-jp','utf-8')
> TVアニメ 帑のまにまに EDテ??`マ仝佛仄のサラウンド々????CooRie
>
> Any ideas? Is there a bug, or some issues with the help?
IMHO, this test case is much simpler:
:echo iconv("\xFF", 'utf-8', 'utf-8')
<ff>
Since 0xFF isn't a valid byte sequence in UTF-8, this should have
returned an empty string according to the docs.
~Matt
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---