Commit db7c7767 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

Allow custom character sets for FTP connections (close #10611)

parent e27467f8
......@@ -3,6 +3,7 @@
* Detection of external subtitles when streaming media via http or ftp (#10668)
* Option to download media from http/ftp/https instead of direct playback when
requested through third-party app (#11147)
* Option to set text encoding used for FTP connections (#10611)
2.3:
----
......
......@@ -400,6 +400,62 @@
<key>Type</key>
<string>IASKButtonSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Titles</key>
<array>
<string>Universal (UTF-8)</string>
<string>Universal (UTF-16)</string>
<string>Universal (big endian UTF-16)</string>
<string>Universal (little endian UTF-16)</string>
<string>Universal (UTF-32)</string>
<string>Universal (big endian UTF-32)</string>
<string>Universal (little endian UTF-32)</string>
<string>Western (Mac OS Roman)</string>
<string>Western (ISO Latin 1)</string>
<string>Western (Windows Latin 1)</string>
<string>Western (ASCII)</string>
<string>Western (NextStep)</string>
<string>Japanese (EUC)</string>
<string>Japanese (Shift JIS)</string>
<string>Non-lossy ASCII</string>
<string>Central European (ISO Latin 2)</string>
<string>Central European (Windows Latin 2)</string>
<string>Cyrillic (Windows)</string>
<string>Turkish (CP1254)</string>
<string>Greek (CP1253)</string>
</array>
<key>Values</key>
<array>
<integer>4</integer>
<integer>10</integer>
<integer>2415919360</integer>
<integer>2483028224</integer>
<integer>2348810496</integer>
<integer>2550137088</integer>
<integer>2617245952</integer>
<integer>30</integer>
<string>5</string>
<string>12</string>
<string>1</string>
<string>2</string>
<string>3</string>
<string>8</string>
<string>7</string>
<string>9</string>
<string>15</string>
<string>11</string>
<string>14</string>
<string>13</string>
</array>
<key>Title</key>
<string>SETTINGS_FTP_TEXT_ENCODING</string>
<key>Key</key>
<string>ftp-text-encoding</string>
<key>DefaultValue</key>
<string>5</string>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>
......
......@@ -368,6 +368,68 @@
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
</dict>
<dict>
<key>Type</key>
<string>PSGroupSpecifier</string>
<key>Title</key>
<string>SETTINGS_FILE_SYNC</string>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Titles</key>
<array>
<string>Universal (UTF-8)</string>
<string>Universal (UTF-16)</string>
<string>Universal (big endian UTF-16)</string>
<string>Universal (little endian UTF-16)</string>
<string>Universal (UTF-32)</string>
<string>Universal (big endian UTF-32)</string>
<string>Universal (little endian UTF-32)</string>
<string>Western (Mac OS Roman)</string>
<string>Western (ISO Latin 1)</string>
<string>Western (Windows Latin 1)</string>
<string>Western (ASCII)</string>
<string>Western (NextStep)</string>
<string>Japanese (EUC)</string>
<string>Japanese (Shift JIS)</string>
<string>Non-lossy ASCII</string>
<string>Central European (ISO Latin 2)</string>
<string>Central European (Windows Latin 2)</string>
<string>Cyrillic (Windows)</string>
<string>Turkish (CP1254)</string>
<string>Greek (CP1253)</string>
</array>
<key>Values</key>
<array>
<integer>4</integer>
<integer>10</integer>
<integer>2415919360</integer>
<integer>2483028224</integer>
<integer>2348810496</integer>
<integer>2550137088</integer>
<integer>2617245952</integer>
<integer>30</integer>
<string>5</string>
<string>12</string>
<string>1</string>
<string>2</string>
<string>3</string>
<string>8</string>
<string>7</string>
<string>9</string>
<string>15</string>
<string>11</string>
<string>14</string>
<string>13</string>
</array>
<key>Title</key>
<string>SETTINGS_FTP_TEXT_ENCODING</string>
<key>Key</key>
<string>ftp-text-encoding</string>
<key>DefaultValue</key>
<integer>5</integer>
</dict>
</array>
<key>StringsTable</key>
<string>Root</string>
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -54,7 +54,7 @@
else
skipLoopFilterDefaultValue = kVLCSettingSkipLoopFilterNonRef;
NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @(NO), kVLCSettingContinueAudioInBackgroundKey : @(YES), kVLCSettingStretchAudio : @(NO), kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue, kVLCSettingSkipLoopFilter : skipLoopFilterDefaultValue, kVLCSettingSubtitlesFont : kVLCSettingSubtitlesFontDefaultValue, kVLCSettingSubtitlesFontColor : kVLCSettingSubtitlesFontColorDefaultValue, kVLCSettingSubtitlesFontSize : kVLCSettingSubtitlesFontSizeDefaultValue, kVLCSettingSubtitlesBoldFont: kVLCSettingSubtitlesBoldFontDefaulValue, kVLCSettingDeinterlace : kVLCSettingDeinterlaceDefaultValue, kVLCSettingNetworkCaching : kVLCSettingNetworkCachingDefaultValue, kVLCSettingPlaybackGestures : [NSNumber numberWithBool:YES]};
NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @(NO), kVLCSettingContinueAudioInBackgroundKey : @(YES), kVLCSettingStretchAudio : @(NO), kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue, kVLCSettingSkipLoopFilter : skipLoopFilterDefaultValue, kVLCSettingSubtitlesFont : kVLCSettingSubtitlesFontDefaultValue, kVLCSettingSubtitlesFontColor : kVLCSettingSubtitlesFontColorDefaultValue, kVLCSettingSubtitlesFontSize : kVLCSettingSubtitlesFontSizeDefaultValue, kVLCSettingSubtitlesBoldFont: kVLCSettingSubtitlesBoldFontDefaulValue, kVLCSettingDeinterlace : kVLCSettingDeinterlaceDefaultValue, kVLCSettingNetworkCaching : kVLCSettingNetworkCachingDefaultValue, kVLCSettingPlaybackGestures : [NSNumber numberWithBool:YES], kVLCSettingFTPTextEncoding : kVLCSettingFTPTextEncodingDefaultValue };
[defaults registerDefaults:appDefaults];
}
......
......@@ -40,6 +40,8 @@
#define kVLCSettingNetworkCachingDefaultValue @(999)
#define kVLCSettingsDecrapifyTitles @"MLDecrapifyTitles"
#define kVLCSettingPlaybackGestures @"EnableGesturesToControlPlayback"
#define kVLCSettingFTPTextEncoding @"ftp-text-encoding"
#define kVLCSettingFTPTextEncodingDefaultValue @(5) // ISO Latin 1
#define kVLCShowRemainingTime @"show-remaining-time"
#define kVLCRecentURLs @"recent-urls"
......@@ -48,7 +50,6 @@
#define kVLCFTPServer @"ftp-server"
#define kVLCFTPLogin @"ftp-login"
#define kVLCFTPPassword @"ftp-pass"
#define kVLCLastFTPServer @"last-ftp-server"
#define kVLCLastFTPLogin @"last-ftp-login"
#define kVLCLastFTPPassword @"last-ftp-pass"
......
......@@ -234,7 +234,7 @@
[ObjList addObjectsFromArray:_objectList];
NSString *rawFileName = [ObjList[indexPath.row] objectForKey:(id)kCFFTPResourceName];
NSData *flippedData = [rawFileName dataUsingEncoding:NSMacOSRomanStringEncoding];
NSData *flippedData = [rawFileName dataUsingEncoding:[[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingFTPTextEncoding] intValue] allowLossyConversion:YES];
cell.title = [[NSString alloc] initWithData:flippedData encoding:NSUTF8StringEncoding];
if ([[ObjList[indexPath.row] objectForKey:(id)kCFFTPResourceType] intValue] == 4) {
......@@ -320,7 +320,7 @@
[self.navigationController pushViewController:targetViewController animated:YES];
} else {
NSString *rawObjectName = [ObjList[indexPath.row] objectForKey:(id)kCFFTPResourceName];
NSData *flippedData = [rawObjectName dataUsingEncoding:NSMacOSRomanStringEncoding];
NSData *flippedData = [rawObjectName dataUsingEncoding:[[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingFTPTextEncoding] intValue] allowLossyConversion:YES];
NSString *properObjectName = [[NSString alloc] initWithData:flippedData encoding:NSUTF8StringEncoding];
if (![properObjectName isSupportedFormat]) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", @"") message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", @""), properObjectName] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:nil];
......@@ -448,7 +448,7 @@
rawObjectName = [ObjList[[self.tableView indexPathForCell:cell].row] objectForKey:(id)kCFFTPResourceName];
}
NSData *flippedData = [rawObjectName dataUsingEncoding:NSMacOSRomanStringEncoding];
NSData *flippedData = [rawObjectName dataUsingEncoding:[[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingFTPTextEncoding] intValue] allowLossyConversion:YES];
NSString *properObjectName = [[NSString alloc] initWithData:flippedData encoding:NSUTF8StringEncoding];
if (![properObjectName isSupportedFormat]) {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", @"") message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED_LONG", @""), properObjectName] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:nil];
......@@ -537,7 +537,7 @@
nameRange = [[item title] rangeOfString:searchString options:NSCaseInsensitiveSearch];
} else if (_serverType == kVLCServerTypeFTP) {
NSString *rawObjectName = [_objectList[i] objectForKey:(id)kCFFTPResourceName];
NSData *flippedData = [rawObjectName dataUsingEncoding:NSMacOSRomanStringEncoding];
NSData *flippedData = [rawObjectName dataUsingEncoding:[[[NSUserDefaults standardUserDefaults] objectForKey:kVLCSettingFTPTextEncoding] intValue] allowLossyConversion:YES];
NSString *properObjectName = [[NSString alloc] initWithData:flippedData encoding:NSUTF8StringEncoding];
nameRange = [properObjectName rangeOfString:searchString options:NSCaseInsensitiveSearch];
}
......
Markdown is supported
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