Use utf8 encoding for 8bit strings

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@18538 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2004-02-04 09:08:26 +00:00
parent 2317f381c0
commit 2d897f60cb
2 changed files with 6 additions and 5 deletions

View file

@ -1,7 +1,7 @@
2004-02-02 Richard Frith-Macdonald <rfm@gnu.org> 2004-02-02 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPropertyList.m: Integrate new parser to * Source/NSPropertyList.m: Integrate new parser to
NSPropertyListSerialisation NSPropertyListSerialisation. Assume 8bit strings are utf8.
2004-02-04 01:10 Alexander Malmberg <alexander@malmberg.org> 2004-02-04 01:10 Alexander Malmberg <alexander@malmberg.org>

View file

@ -2301,7 +2301,7 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
unsigned char postfix[32]; unsigned char postfix[32];
// FIXME: Get more of the details // FIXME: Get more of the details
[data getBytes: postfix range: NSMakeRange(length-32, 32)]; [plData getBytes: postfix range: NSMakeRange(length-32, 32)];
size = postfix[6]; size = postfix[6];
if (size < 1 || size > 2) if (size < 1 || size > 2)
{ {
@ -2517,16 +2517,17 @@ OAppend(id obj, NSDictionary *loc, unsigned lev, unsigned step,
{ {
// Short string // Short string
unsigned len = next - 0x50; unsigned len = next - 0x50;
unsigned char buffer[len]; unsigned char buffer[len+1];
[data getBytes: buffer range: NSMakeRange(counter, len)]; [data getBytes: buffer range: NSMakeRange(counter, len)];
buffer[len] = '\0';
if (mutability == NSPropertyListMutableContainersAndLeaves) if (mutability == NSPropertyListMutableContainersAndLeaves)
{ {
result = [NSMutableString stringWithCString: buffer length: len]; result = [NSMutableString stringWithUTF8String: buffer];
} }
else else
{ {
result = [NSString stringWithCString: buffer length: len]; result = [NSString stringWithUTF8String: buffer];
} }
} }
else if (next == 0x5F) else if (next == 0x5F)