+2002-02-16 Radek Doulik <rodo@ximian.com>
+
+ * unicode.c (ves_icall_iconv_new_encoder): decide on big_endian,
+ force big_endian to be 1 for big endian machines
+ (ves_icall_iconv_new_decoder): ditto
+
2002-02-16 Jeffrey Stedfast <fejj@ximian.com>
* socket-io.c (convert_sockopt_level_and_name): If the system
iconv_t cd;
char *n;
- // fixme: add support big_endian
+ // fixme: don't enforce big endian, support old iconv
g_assert (name);
n = mono_string_to_utf8 (name);
+ /* force big endian before class libraries are fixed */
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+ big_endian = 1;
+#endif
+
#ifdef HAVE_NEW_ICONV
- cd = iconv_open (n, "UTF-16le");
+ cd = iconv_open (n, big_endian ? "UTF-16be" : "UTF-16le");
#else
cd = iconv_open (n, "UTF-16");
#endif
iconv_t cd;
char *n;
- // fixme: add support big_endian
+ // fixme: don't enforce big endian, support old iconv
g_assert (name);
n = mono_string_to_utf8 (name);
+ /* force big endian before class libraries are fixed */
+#if G_BYTE_ORDER != G_LITTLE_ENDIAN
+ big_endian = 1;
+#endif
+
#ifdef HAVE_NEW_ICONV
- cd = iconv_open ("UTF-16le", n);
+ cd = iconv_open (big_endian ? "UTF-16be" : "UTF-16le", n);
#else
cd = iconv_open ("UTF-16", n);
#endif