我有这样的一些网址数组:JavaScript的去使用Unicode字符的URL
[
"path/to/url1",
"path/to/url2",
"path/url/unicóde.txt"
]
我使用的是棱角分明,ng-repeat
我创建了执行重定向到所需的URL可点击列表,但是,当我点击unicode网址时,浏览器无法找到它。
我试着用,但它检索到这个: path/url/unic%C3%B3de.txt
找不到。相反,当我手动访问:path/url/unicóde.txt
(这是一个ftp,所以,我按文件夹直到到达文件)浏览器中的网址现在说:path/url/unic%F3de.txt
,这与给我encodeURI()
的值不同。
然后,我可以clic这个列表项,并被重定向到所需的unicode网址?
下面的代码: HTML:
<md-list-item ng-repeat="found in foundFiles">
<h3>{{ found.name }}</h3>
<p ng-click="openFtpLink(found.url)">{{ found.url}}</p>
</md-list-item>
的javascript:
$scope.foundFiles = [...]
$scope.openFtpLink = function (ftpLink) {
var spawn = require('child_process').spawn;
spawn('cmd.exe', ['/c', 'start', '', ftpLink]);
};
这是一个应用程序建立与电子+的角度,我想在这里的是,当用户点击菜单,打开他的默认浏览器并将其重定向到url
尝试在脚本标签中添加'charset =“utf-8”'。 –
“我创建了一个可点击的列表,执行重定向到所需的url” - 需要查看代码,因为您似乎在解码URL(或缺少URL)方面做了错误。 – Amadan