浏览代码

Fix subtitle downloads by not messing encodings

VLC was downloading subtitle files as an NSString and assumed certain
encodings. This is useless to do in the controller, because VLCKit will,
eventually, autodetect encodings and “do the right thing”.

Because of this, some subtitle files (e.g: UTF-16 encoded ones) wouldn't
work over the network, but would work if copied to the device.

Signed-off-by: Felix Paul Kühne <fkuehne@videolan.org>
Filipe Cabecinhas 10 年之前
父节点
当前提交
dd7bcb2b11
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Sources/VLCOpenNetworkStreamViewController.m

+ 2 - 2
Sources/VLCOpenNetworkStreamViewController.m

@@ -283,7 +283,7 @@ forRowAtIndexPath:(NSIndexPath *)indexPath
         NSInteger httpStatus = [(NSHTTPURLResponse *)response statusCode];
 
         if (httpStatus == 200) {
-            NSString *receivedSub = [NSString stringWithContentsOfURL:checkURL encoding:NSASCIIStringEncoding error:nil];
+            NSData *receivedSub = [NSData dataWithContentsOfURL:checkURL];
 
             NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
             NSString *directoryPath = searchPaths[0];
@@ -297,7 +297,7 @@ forRowAtIndexPath:(NSIndexPath *)indexPath
                     APLog(@"file creation failed, no data was saved");
             }
 
-            [receivedSub writeToFile:fileSubtitlePath atomically:YES encoding:NSUTF8StringEncoding error:nil];
+            [receivedSub writeToFile:fileSubtitlePath atomically:YES];
             return fileSubtitlePath;
         }
     }