简体   繁体   中英

phantomjs with non-english url

in querystring part of my url passing to phantomjs in python, I have values in persian language. But after capturing the result using driver.save_screenshot('screen.png'), I see the querystring did not apply. 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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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