Fix for where default encoding is not internal encoding.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@19461 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-06-05 09:34:41 +00:00
parent a4b37594c5
commit 9e5bc129ed
3 changed files with 18 additions and 2 deletions

View file

@ -1,6 +1,10 @@
2004-06-05 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSDictionary.m: Make exceptions a little more informative.
* Source/NSString.m: initWithFormat... externalise result of GSFormat
so it works when the default character encoding is not the same as
the internal 8-bit encoding.
* Source/GSString.m: New function to externalize a string.
2004-06-03 David Ayers <d.ayers@inode.at>

View file

@ -310,8 +310,6 @@ setup(void)
}
}
/*
* The GSPlaceholderString class is used by the abstract cluster root
* class to provide temporary objects that will be replaced as soon
@ -4204,3 +4202,15 @@ void GSStrAppendUnichar(GSStr s, unichar u)
}
}
/*
* Make the content of this string into unicode if it is not in
* the external defaults C string encoding.
*/
void GSStrExternalize(GSStr s)
{
if (s->_flags.wide == 0 && intEnc != defEnc)
{
GSStrWiden(s);
}
}

View file

@ -1154,6 +1154,7 @@ handle_printf_atsign (FILE *stream,
locale: (NSDictionary*)locale
arguments: (va_list)argList
{
extern void GSStrExternalize();
unsigned char buf[2048];
GSStr_t f;
unichar fbuf[1024];
@ -1186,6 +1187,7 @@ handle_printf_atsign (FILE *stream,
f._flags.wide = 0;
f._flags.free = 0;
GSFormat(&f, fmt, argList, locale);
GSStrExternalize(&f);
if (fmt != fbuf)
{
objc_free(fmt);