Commit dd7bcb2b authored by Filipe Cabecinhas's avatar Filipe Cabecinhas Committed by Felix Paul Kühne
Browse files

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's avatarFelix Paul Kühne <>
parent dd861306
......@@ -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;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment