File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -406,10 +406,29 @@ - (NSArray*)applicationTargets
406406 return filteredTargets;
407407}
408408
409+ - (NSData *)_fixEncodingInData : (NSData *)data
410+ {
411+ NSString *source = [[NSString alloc ] initWithData: data encoding: NSUTF8StringEncoding];
412+ NSMutableString *destination = @" " .mutableCopy ;
413+ for (int i = 0 ; i < source.length ; i++) {
414+ unichar c = [source characterAtIndex: i];
415+ if (c < 128 ) {
416+ [destination appendFormat: @" %c " , c];
417+ } else {
418+ [destination appendFormat: @" &#%u ;" , c];
419+ }
420+ }
421+
422+ return [destination dataUsingEncoding: NSUTF8StringEncoding];
423+ }
424+
409425- (void )save
410426{
411427 [_fileOperationQueue commitFileOperations ];
412- [_dataStore writeToFile: [_filePath stringByAppendingPathComponent: @" project.pbxproj" ] atomically: YES ];
428+
429+ NSData *data = [NSPropertyListSerialization dataWithPropertyList: _dataStore format: NSPropertyListXMLFormat_v1_0 options: 0 error: NULL ];
430+ data = [self _fixEncodingInData: data];
431+ [data writeToFile: [_filePath stringByAppendingPathComponent: @" project.pbxproj" ] atomically: YES ];
413432
414433 // Don't forget to reset the cache so that we'll always get the latest data.
415434 [self dropCache ];
You can’t perform that action at this time.
0 commit comments