use initWithBytes:length:encoding: method on NSString to convert the XML data to a string more cleanly, add AUTORELEASE of the string

This commit is contained in:
Gregory John Casamento 2023-07-13 21:52:26 -04:00
parent 14e64ef759
commit eadd4e2ab2

View file

@ -3508,8 +3508,9 @@ static void _real_close(GormDocument *self,
[self _buildXLIFFDocumentWithParentNode: group];
NSData *data = [xliffDocument XMLDataWithOptions: NSXMLNodePrettyPrint | NSXMLNodeCompactEmptyElement ];
NSString *xmlString = [NSString stringWithUTF8String: [data bytes]];
NSString *xmlString = [[NSString alloc] initWithBytes: [data bytes] length: [data length] encoding: NSUTF8StringEncoding];
AUTORELEASE(xmlString);
result = [xmlString writeToFile: name atomically: YES];
}
else