utf16 fix

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17654 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2003-09-11 05:40:55 +00:00
parent 77ee3e21e5
commit eaee725163
2 changed files with 6 additions and 10 deletions

View file

@ -1,6 +1,8 @@
2003-09-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Unicode.m: Fix minor errors in utf8 handling.
Use endian version of UTF16 to avoid iconv inserting BOM where
it is not wanted.
2003-09-10 David Ayers <d.ayers@inode.at>

View file

@ -68,9 +68,9 @@ typedef struct {unichar from; unsigned char to;} _ucc_;
/*
* The whole of the GNUstep code stores UNICODE in internal byte order,
* so we do the same. We have switched to using UTF16 so the defines here
* recognise this. We try the generic UTF16 first, followed by the endian
* specifi versions. If not we try the original defines and then back to
* UCS-2-INTERNAL.
* recognise this. We use the endian specific versions of UTF16 so that
* iconv does not introduce a BOM where we do not want it.
* If UTF16 does not work, we revert to UCS-2-INTERNAL.
*/
#ifdef WORDS_BIGENDIAN
#define UNICODE_UTF16 "UTF-16BE"
@ -89,13 +89,7 @@ static const char *
internal_unicode_enc(void)
{
iconv_t conv;
unicode_enc = "UTF-16";
conv = iconv_open(unicode_enc, "ASCII");
if (conv != (iconv_t)-1)
{
iconv_close(conv);
return unicode_enc;
}
unicode_enc = UNICODE_UTF16;
conv = iconv_open(unicode_enc, "ASCII");
if (conv != (iconv_t)-1)