This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch binutils]: Fix for PR 13409 - winders should specify host endianness for iconv explicitly
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Fri, 17 Aug 2012 21:13:27 +0200
- Subject: [patch binutils]: Fix for PR 13409 - winders should specify host endianness for iconv explicitly
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)
{
--
| (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination