Hi Bram!

On Mo, 23 Nov 2009, Bram Moolenaar wrote:

> Yongwei Wu reported a similar problem last week.  It appears that
> iconv() tries conversion even when there are errors.  If you get an
> error message when loading the file that should also happen with
> iconv().
> 
> Although getting an empty string on an error is good to notice something
> went wrong, other times you might want to get whatever could be
> converted.  We could add an argument tells it to fail or do a "best
> effort" conversion.  I'm not sure that will always be possible, we
> depend on what the iconv library does.

Well, iconv_open()¹ allows to append the special string //TRANSLIT and 
//IGNORE on the target-charset, in which case a character that cannot
be represented in the target character set will be approximated through 
one or several characters, that look similar to the original character 
(//TRANSLIT case) or non-valid chars in the target charset will be 
silently discarded (//IGNORE case).

¹)at least on a GNU System (see 
http://www.gnu.org/software/libiconv/documentation/libiconv/iconv_open.3.html)

regards,
Christian

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui