M
M
MadJeck2010-11-25 02:47:33
Python
MadJeck, 2010-11-25 02:47:33

How to make PyQt work with Russian domains?

I ran into a problem when working with QUrl in python. In general, we have the following test code:

from PyQt4.QtCore import QUrl<br/>
<br/>
print QUrl('http://xn--d1abbgf6aiiy.xn--p1ai/').toString()<br/>


Under windows it returns the expected result:
<a href="http://xn--d1abbgf6aiiy.xn--p1ai/">xn--d1abbgf6aiiy.xn--p1ai/</a>


And under FreeBSD this:
<a href="http://xn--d1abbgf6aiiy.xn--d1abbgf6aiiyxn--p1ai/">xn--d1abbgf6aiiy.xn--d1abbgf6aiiyxn--p1ai/</a>


PyQt from here www.riverbankcomputing.co.uk/software/pyqt/download version 4.8.1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
FeNUMe, 2010-11-25
@FeNUMe

I don’t know what the problem is with PyQt, but it can be bypassed by forced conversion of the url to idna
//encode domain.rf in xn--d1acufc.xn--p1ai
domain = domain_rf.encode('idna')
//decode xn--d1acufc. xn--p1ai to domain.rf
domain = domain_rf.decode('idna')

D
DeNnEr, 2010-11-28
@DeNnEr

If this is the case, then this is a degradation of PyQt, and possibly Qt itself. I advise you to address this to the mailing list or to the PyQt bug tracker first, and then, if they say that it is a Qt problem, to the Qt bug tracker.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question