Skip to content

[VLCMedia mediaWithURL:] with chinese text in url not work

Here is my code:

NSString *str = @"http://www.x.com/中文.mp3";
NSString *playUrlStr = [str stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]; // must encode when chinese text, solve NSURL return nil
NSURL *url = [NSURL URLWithString:playUrlStr];
VLCMedia *media = [VLCMedia mediaWithURL:url];

This always double encode url, becase in initInternalMediaDescriptor method, [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] is used.

I try [VLCMedia mediaWithPath:playUrlStr], but it is only support smb/sftp.

Thank you for fix this bug.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information