Merge branch 'bc/utf16-portability-fix'
authorJunio C Hamano <gitster@pobox.com>
Thu, 14 Feb 2019 02:18:41 +0000 (18:18 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 14 Feb 2019 02:18:41 +0000 (18:18 -0800)
The code and tests assume that the system supplied iconv() would
always use BOM in its output when asked to encode to UTF-16 (or
UTF-32), but apparently some implementations output big-endian
without BOM. A compile-time knob has been added to help such
systems (e.g. NonStop) to add BOM to the output to increase
portability.

* bc/utf16-portability-fix:
utf8: handle systems that don't write BOM for UTF-16

1  2 
Makefile
diff --combined Makefile
index af7e809ced694635d1281dbcf3f0ab234ce3c137,457311bc31b54c48aa17f6abdc487baa174786e1..f0b2299172cf631470e1935869021bebb0e5ea96
+++ b/Makefile
@@@ -259,6 -259,10 +259,10 @@@ all:
  # Define OLD_ICONV if your library has an old iconv(), where the second
  # (input buffer pointer) parameter is declared with type (const char **).
  #
+ # Define ICONV_OMITS_BOM if your iconv implementation does not write a
+ # byte-order mark (BOM) when writing UTF-16 or UTF-32 and always writes in
+ # big-endian format.
+ #
  # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
  #
  # Define NO_R_TO_GCC_LINKER if your gcc does not like "-R/path/lib"
  #
  # Define HAVE_GETDELIM if your system has the getdelim() function.
  #
 +# Define FILENO_IS_A_MACRO if fileno() is a macro, not a real function.
 +#
  # Define PAGER_ENV to a SP separated VAR=VAL pairs to define
  # default environment variables to be passed when a pager is spawned, e.g.
  #
@@@ -1417,6 -1419,9 +1421,9 @@@ ifndef NO_ICON
                EXTLIBS += $(ICONV_LINK) -liconv
        endif
  endif
+ ifdef ICONV_OMITS_BOM
+       BASIC_CFLAGS += -DICONV_OMITS_BOM
+ endif
  ifdef NEEDS_LIBGEN
        EXTLIBS += -lgen
  endif
@@@ -1802,11 -1807,6 +1809,11 @@@ ifdef HAVE_WPGMPT
        BASIC_CFLAGS += -DHAVE_WPGMPTR
  endif
  
 +ifdef FILENO_IS_A_MACRO
 +      COMPAT_CFLAGS += -DFILENO_IS_A_MACRO
 +      COMPAT_OBJS += compat/fileno.o
 +endif
 +
  ifeq ($(TCLTK_PATH),)
  NO_TCLTK = NoThanks
  endif