react-native 中IOS端包含中文字符、特殊字符的下载链接不能下载问题解决

let videoUrl = encodeURL(url)

参考链接:https://stackoverflow.com/questions/53677395/react-native-unsupported-url-ios
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI

图片.png
const uri = 'https://mozilla.org/?x=шеллы';
const encoded = encodeURI(uri);
console.log(encoded);
// expected output: "https://mozilla.org/?x=%D1%88%D0%B5%D0%BB%D0%BB%D1%8B"

try {
  console.log(decodeURI(encoded));
  // expected output: "https://mozilla.org/?x=шеллы"
} catch (e) { // Catches a malformed URI
  console.error(e);
}

你可能感兴趣的:(react-native 中IOS端包含中文字符、特殊字符的下载链接不能下载问题解决)