bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnu-libiconv] iconv fails to convert utf8 with bom to cp1251


From: Nayana Hettiarachchi
Subject: Re: [bug-gnu-libiconv] iconv fails to convert utf8 with bom to cp1251
Date: Fri, 8 Dec 2017 07:26:14 +0700

in all fairness a less almighty and simple vconi is almost done. much simpler interface. no hacks. and a friendly guy to talk to soon on a computer near you. 

On Dec 8, 2017 06:25, "Bruno Haible" <address@hidden> wrote:
Hi,

> > iconv SHOULD not allow a BOM in this conversion
>
> Should doesn't mean must. Anyway I didn't provide any input encoding,
> only output.

iconv always takes an input encoding. If you didn't specify an explicit
encoding, you implicitly specified the locale's encoding, which under
Linux nowadays most likely is UTF-8.

> So how to escape this problem? I see two options: add another encoding
> called utf8-bom or ignore bom character.

Once you know that the file is in UTF-8+BOM encoding, you need to
strip off the BOM:
  $ tail --bytes=+4 < FILE | iconv -f UTF-8 -t ...

Bruno


_______________________________________________
bug-gnu-libiconv mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-gnu-libiconv

reply via email to

[Prev in Thread] Current Thread [Next in Thread]