diff --git a/ChangeLog b/ChangeLog index 962f6cde9..fd45d7812 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-06-28 Richard Frith-Macdonald + + * Source/NSString.m: Change to quote strings in plist output + aggressively (quote characters that don't really need quoting) + while still parsing flexibly ... ie handle unquoted strings as + long as they don't contain 'special' characters. + Fix for Tom Hageman + 2002-06-27 Richard Frith-Macdonald * Tools/AGSParser.m: ([-parseDeclaration:]) Correct wrongly diff --git a/Source/NSString.m b/Source/NSString.m index 8eced104c..5ed9b48b5 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -137,6 +137,7 @@ static void setupHexdigits() } static NSCharacterSet *quotables = nil; +static NSCharacterSet *oldQuotables = nil; static unsigned const char *quotablesBitmapRep = NULL; #define GS_IS_QUOTABLE(X) IS_BIT_SET(quotablesBitmapRep[(X)/8], (X) % 8) @@ -145,7 +146,7 @@ static void setupQuotables() if (quotablesBitmapRep == NULL) { NSMutableCharacterSet *s; - NSData *bitmap; + NSData *bitmap; s = [[NSCharacterSet characterSetWithCharactersInString: @"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" @@ -156,6 +157,13 @@ static void setupQuotables() RELEASE(s); bitmap = RETAIN([quotables bitmapRepresentation]); quotablesBitmapRep = [bitmap bytes]; + s = [[NSCharacterSet characterSetWithCharactersInString: + @"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + @"abcdefghijklmnopqrstuvwxyz$./_"] + mutableCopy]; + [s invert]; + oldQuotables = [s copy]; + RELEASE(s); } } @@ -3371,7 +3379,7 @@ handle_printf_atsign (FILE *stream, { setupQuotables(); } - if ([self rangeOfCharacterFromSet: quotables].length > 0 + if ([self rangeOfCharacterFromSet: oldQuotables].length > 0 || [self characterAtIndex: 0] == '/') { unichar tmp[length <= 1024 ? length : 0];