Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -446,25 +446,27 @@ } cArray = [array cArray]; count = [array count]; if ([self isKindOfClass: [OFMutableArray class]]) - ret = [OFMutableString stringWithFormat: @"(", + ret = [OFMutableString stringWithFormat: @"(\n", count]; else - ret = [OFMutableString stringWithFormat: @"<%zd>(", count]; + ret = [OFMutableString stringWithFormat: @"<%zd>(\n", count]; pool = [[OFAutoreleasePool alloc] init]; append = [ret methodForSelector: @selector(appendString:)]; for (i = 0; i < count - 1; i++) { append(ret, @selector(appendString:), [cArray[i] stringBySerializing]); - append(ret, @selector(appendString:), @", "); + append(ret, @selector(appendString:), @",\n"); [pool releaseObjects]; } - [ret appendFormat: @"%@)", [cArray[i] stringBySerializing]]; + [ret replaceOccurrencesOfString: @"\n" + withString: @"\n\t"]; + [ret appendFormat: @"%@\n)", [cArray[i] stringBySerializing]]; [pool release]; /* * Class swizzle the string to be immutable. We declared the return type Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -771,14 +771,14 @@ else return @"<0>{}"; } if ([self isKindOfClass: [OFMutableDictionary class]]) - ret = [OFMutableString stringWithFormat: @"{", + ret = [OFMutableString stringWithFormat: @"{\n", count]; else - ret = [OFMutableString stringWithFormat: @"<%zd>{", count]; + ret = [OFMutableString stringWithFormat: @"<%zd>{\n", count]; pool = [[OFAutoreleasePool alloc] init]; keyEnumerator = [self keyEnumerator]; objectEnumerator = [self objectEnumerator]; i = 0; @@ -789,15 +789,17 @@ [ret appendString: [key stringBySerializing]]; [ret appendString: @" = "]; [ret appendString: [object stringBySerializing]]; if (++i < count) - [ret appendString: @"; "]; + [ret appendString: @";\n"]; [pool2 releaseObjects]; } - [ret appendString: @"}"]; + [ret replaceOccurrencesOfString: @"\n" + withString: @"\n\t"]; + [ret appendString: @";\n}"]; [pool release]; /* * Class swizzle the string to be immutable. We declared the return type Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1060,10 +1060,16 @@ OFMutableString *serialization = [[self mutableCopy] autorelease]; [serialization replaceOccurrencesOfString: @"\\" withString: @"\\\\"]; [serialization replaceOccurrencesOfString: @"\"" withString: @"\\\""]; + [serialization replaceOccurrencesOfString: @"\n" + withString: @"\\n\"\n \""]; + [serialization replaceOccurrencesOfString: @"\r" + withString: @"\\r"]; + [serialization replaceOccurrencesOfString: @"\t" + withString: @"\\t"]; if ([self isKindOfClass: [OFMutableString class]]) [serialization prependString: @"\""]; else [serialization prependString: @"\""];