Updated Branches: refs/heads/2.9.x a1f3c82af -> bd6181309
[CB-4033] Relaxed case-sensitivity of "UTF-8". FileReader.readAsText previously did not accept, for example, "utf-8". Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/bd618130 Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/bd618130 Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/bd618130 Branch: refs/heads/2.9.x Commit: bd61813094c31625b70d343f8d6c26285d1b1e5c Parents: a1f3c82 Author: Max Woghiren <[email protected]> Authored: Thu Jun 27 14:52:02 2013 -0400 Committer: Max Woghiren <[email protected]> Committed: Tue Jul 2 12:03:22 2013 -0400 ---------------------------------------------------------------------- CordovaLib/Classes/CDVFile.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/bd618130/CordovaLib/Classes/CDVFile.m ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVFile.m b/CordovaLib/Classes/CDVFile.m index 9487dd4..2ca9464 100644 --- a/CordovaLib/Classes/CDVFile.m +++ b/CordovaLib/Classes/CDVFile.m @@ -1132,7 +1132,7 @@ NSString* const kCDVAssetsLibraryPrefix = @"assets-library://"; NSInteger end = [[command argumentAtIndex:3] integerValue]; // TODO: implement - if (![@"UTF-8" isEqualToString : encoding]) { + if ([@"UTF-8" caseInsensitiveCompare : encoding] != NSOrderedSame) { NSLog(@"Only UTF-8 encodings are currently supported by readAsText"); CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_IO_EXCEPTION messageAsInt:ENCODING_ERR]; [self.commandDelegate sendPluginResult:result callbackId:command.callbackId]; @@ -1332,10 +1332,9 @@ NSString* const kCDVAssetsLibraryPrefix = @"assets-library://"; } else if ([argData isKindOfClass:[NSData class]]) { [self writeToFile:fullPath withData:argData append:YES callback:callbackId]; } else { - CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid parameter type"]; - [self.commandDelegate sendPluginResult:result callbackId:callbackId]; + CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Invalid parameter type"]; + [self.commandDelegate sendPluginResult:result callbackId:callbackId]; } - } - (void)writeToFile:(NSString*)filePath withData:(NSData*)encData append:(BOOL)shouldAppend callback:(NSString*)callbackId
