example7.rst revision 238106
1238106Sdes.. _example_idna: 2238106Sdes 3238106Sdes================================================= 4238106SdesInternationalized domain name support 5238106Sdes================================================= 6238106Sdes 7238106SdesUnlike the libUnbound, pyUnbound is able to handle IDN queries. 8238106Sdes 9238106Sdes.. literalinclude:: example7-1.py 10238106Sdes :language: python 11238106Sdes 12238106SdesIf we use unicode string in :meth:`unbound.ub_ctx.resolve` method, the IDN DNAME conversion (if it is necessary) is performed on background. 13238106Sdes 14238106Sdes.. literalinclude:: example7-2.py 15238106Sdes :language: python 16238106Sdes 17238106SdesThe :class:`unbound.ub_data` class contains attributes suffix which converts the dname to UTF string. These attributes have the '_idn' suffix. 18238106SdesApart from this aproach, two conversion functions exist (:func:`unbound.idn2dname` and :func:`unbound.dname2idn`). 19