(serializeToInfo): Only save a string as a cstring if it only contains ASCII characters.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18052 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
alexm 2003-11-05 13:52:18 +00:00
parent f97029e9b2
commit ccf66c5058
2 changed files with 14 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2003-11-05 14:49 Alexander Malmberg <alexander@malmberg.org>
* Source/NSSerializer.m (serializeToInfo): Only save a string as
a cstring if it only contains ASCII characters.
2003-11-05 03:10 Alexander Malmberg <alexander@malmberg.org> 2003-11-05 03:10 Alexander Malmberg <alexander@malmberg.org>
* Source/GSString.m: Reorganize class heirarchy. Remove unused * Source/GSString.m: Reorganize class heirarchy. Remove unused

View file

@ -182,8 +182,15 @@ serializeToInfo(id object, _NSSerializerInfo* info)
[object description]]; [object description]];
} }
c = GSObjCClass(object); c = GSObjCClass(object);
if (GSObjCIsKindOf(c, CStringClass)
|| (c == MStringClass && ((ivars)object)->_flags.wide == 0)) if ((GSObjCIsKindOf(c, CStringClass)
|| (c == MStringClass && ((ivars)object)->_flags.wide == 0))
/*
We can only save it as a c-string if it only contains ASCII characters.
Other characters might be decoded incorrectly when deserialized since
the c-string encoding might be different then.
*/
&& [object canBeConvertedToEncoding: NSASCIIStringEncoding])
{ {
GSIMapNode node; GSIMapNode node;