简体   繁体   English

带有非英文网址的 phantomjs

[英]phantomjs with non-english url

in querystring part of my url passing to phantomjs in python, I have values in persian language.在我的 url 的查询字符串部分传递给 python 中的 phantomjs,我有波斯语的值。 But after capturing the result using driver.save_screenshot('screen.png'), I see the querystring did not apply.但是在使用 driver.save_screenshot('screen.png') 捕获结果后,我看到查询字符串不适用。 Actually it's a search page and it returns no result.实际上它是一个搜索页面,它没有返回任何结果。 By removing the persian querystring, with other part of querystring which is numbers, everything is ok.通过删除波斯语查询字符串,查询字符串的其他部分是数字,一切正常。
This does not work :这不起作用:

http://codal.ir/ReportList.aspx?1=خودرو&2=&3=&4=-1&5=&6=&7=&8=-1&9=12&10=-1&11=1395%2f12%2f29&12=False&13=0 http://codal.ir/ReportList.aspx?1=خودرو&2=&3=&4=-1&5=&6=&7=&8=-1&9=12&10=-1&11=1395%2f12%2f29&12=False&13=0

And this works: 这有效:

http://codal.ir/ReportList.aspx?2=&3=&4=-1&5=&6=&7=&8=-1&9=12&10=-1&11=1395%2f12%2f29&12=False&13=0 http://codal.ir/ReportList.aspx?2=&3=&4=-1&5=&6=&7=&8=-1&9=12&10=-1&11=1395%2f12%2f29&12=False&13=0

Try using escaped string instead of raw persian characters:尝试使用转义字符串而不是原始波斯字符:

>>> import urllib
>>> urllib.quote('خودرو')
'%D8%AE%D9%88%D8%AF%D8%B1%D9%88'

This MAY fix your problem.这可能会解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM