gas/:
[deliverable/binutils-gdb.git] / binutils / winduni.c
index 1af3c39cb6440f548912d56a7b1b8580b328b405..572145effefb3ee03845b26d9e7cba8402b7c973 100644 (file)
@@ -1,5 +1,5 @@
 /* winduni.c -- unicode support for the windres program.
-   Copyright 1997, 1998, 2000, 2001, 2003, 2007, 2009
+   Copyright 1997, 1998, 2000, 2001, 2003, 2005, 2007, 2009
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
    Rewritten by Kai Tietz, Onevision.
@@ -616,7 +616,7 @@ codepage_from_unicode (rc_uint_type *length, const unichar *unicode, char **asci
     *length = len;
 }
 
-#ifdef HAVE_ICONV
+#if defined (HAVE_ICONV) && !defined (_WIN32) && !defined (__CYGWIN__)
 static int
 iconv_onechar (iconv_t cd, ICONV_CONST char *s, char *d, int d_len, const char **n_s, char **n_d)
 {
@@ -661,7 +661,15 @@ wind_MultiByteToWideChar (rc_uint_type cp, const char *mb,
   rc_uint_type ret = 0;
 
 #if defined (_WIN32) || defined (__CYGWIN__)
-  ret = (rc_uint_type) MultiByteToWideChar (cp, MB_PRECOMPOSED,
+  rc_uint_type conv_flags = MB_PRECOMPOSED;
+
+  /* MB_PRECOMPOSED is not allowed for UTF-7 or UTF-8.  
+     MultiByteToWideChar will set the last error to
+     ERROR_INVALID_FLAGS if we do. */
+  if (cp == CP_UTF8 || cp == CP_UTF7)
+    conv_flags = 0;
+
+  ret = (rc_uint_type) MultiByteToWideChar (cp, conv_flags,
                                            mb, -1, u, u_len);
   /* Convert to bytes. */
   ret *= sizeof (unichar);
This page took 0.023348 seconds and 4 git commands to generate.