【问题标题】:phantomjs unable to load files which its path contains non-ascii charactersphantomjs 无法加载其路径包含非 ascii 字符的文件
【发布时间】:2015-02-24 15:40:25
【问题描述】:

尝试加载带有路径的本地文件

"file:///C:/phantom/ŞUBAT-2015-1.xhtml"

包含非ASCII字符,给出这个例外:

无法加载网址:“file:///C:/phantom/?UBAT-2015-1.xhtml”

如何让phantomjs定位文件?

顺便说一下,不能改文件名。

注释:在脚本中,尝试这样的操作:require('fs').write("filename.txt", path, 'w') puts将正确的文件名放入 filename.txt

谢谢。

【问题讨论】:

    标签: javascript phantomjs


    【解决方案1】:

    Yavu,您能否为您的问题添加更多代码? (如果不了解更多上下文,很难弄清楚出了什么问题)

    话虽如此,您可以尝试使用标志--web-security=false 来允许phantomjs 在另一个页面的上下文中访问您的本地文件。您可以在命令行上运行phantomjs --web-security=false yourScript.js 进行尝试。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多