[patch binutils]: Fix for PR 13409 - winders should specify host endianness for iconv explicitly

NightStrike nightstrike@gmail.com
Wed Nov 14 13:02:00 GMT 2012


On Fri, Aug 17, 2012 at 3:13 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
> Hi,
>
> this patch adjusts winduni's UTF-16 conversion routines to use always
> little-endian format in iconv.  This fixes the problems on MAC, which
> uses as default for "UTF-16" format big-endian.
>
> 2012-08-17  Kai Tietz
>
>         PR ld/13409
>         * winduni.c (codepages): Change "UTF-16" to "UTF-16LE".
>         (wind_MultiByteToWideChar): Likewise.
>         (wind_WideCharToMultiByte): Likewise.
>
> Tested for i686-w64-mingw32, and x86_64-w64-mingw32.  Ok for apply?
> Regards,
> Kai
>
>
> Index: src/binutils/winduni.c
> ===================================================================
> --- src.orig/binutils/winduni.c
> +++ src/binutils/winduni.c
> @@ -85,7 +85,7 @@ static local_iconv_map codepages[] =
>    { 1258, "WINDOWS-1258" },
>    { CP_UTF7, "UTF-7" },
>    { CP_UTF8, "UTF-8" },
> -  { CP_UTF16, "UTF-16" },
> +  { CP_UTF16, "UTF-16LE" },
>    { (rc_uint_type) -1, NULL }
>  };
>
> @@ -770,7 +770,7 @@ wind_MultiByteToWideChar (rc_uint_type c
>
>    if (!mb || !iconv_name)
>      return 0;
> -  iconv_t cd = iconv_open ("UTF-16", iconv_name);
> +  iconv_t cd = iconv_open ("UTF-16LE", iconv_name);
>
>    while (1)
>      {
> @@ -843,7 +843,7 @@ wind_WideCharToMultiByte (rc_uint_type c
>
>    if (!u || !iconv_name)
>      return 0;
> -  iconv_t cd = iconv_open (iconv_name, "UTF-16");
> +  iconv_t cd = iconv_open (iconv_name, "UTF-16LE");
>
>    while (1)
>      {


Ping.  This is an old one that never went in.  Bugzilla link:
http://sourceware.org/bugzilla/show_bug.cgi?id=13409



More information about the Binutils mailing list