Re: [PATCH v2 2/3] configure.ac: define ICONV_OMITS_BOM if necessary

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

 



On Fri, Nov 01, 2019 at 03:25:10PM +0700, Doan Tran Cong Danh wrote:

> From commit 79444c9294, ("utf8: handle systems that don't write BOM for
> UTF-16", 2019-02-12), we're supporting those systems with iconv that
> omits BOM with:
> 
>     make ICONV_OMITS_BOM=Yes
> 
> However, typing the flag all the time is cumbersome and error-prone.
> 
> Add a checking into configure script to detect this flag automatically.

s/checking/check/

The patch looks good to me, though my knowledge of both iconv and
autoconf is relatively lacking. I'll assume it works on your system,
though. :)

One thing I noticed:

> +	v = (unsigned char)(out[0]) + (unsigned char)(out[1]);
> +	return v != 0xfe + 0xff;

I wondered at first why not just:

  return v[0] != 0xfe || v[1] != 0xff;

but the answer is that you are catching BOMs of either endianness. We
might at some point need to distinguish the two, but I think for the
purposes of OMITS_BOM, we don't have to care. So we can worry about that
later (if ever).

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux