Yongwei Wu wrote:
> 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?
>
> This behaviour is reproduced on Windows, Mac OS X, and Linux.
>
> If the iconv call returned an empty string, it could be used in a
> plug-in to detect a mistake in guessing the encoding.
I can't reproduce the problem. The example you give appears to be valid
text. You mention it's cp936, but the mail was sent as iso-2022-jp.
Can you attach a file with the text containing the illegal byte
sequence?
--
Engineers will go without food and hygiene for days to solve a problem.
(Other times just because they forgot.)
(Scott Adams - The Dilbert principle)
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---