13b6c3722Schristos.. _example_idna: 23b6c3722Schristos 33b6c3722SchristosInternationalized domain name support 4*0cd9f4ecSchristos===================================== 53b6c3722Schristos 63b6c3722SchristosUnlike the libUnbound, pyUnbound is able to handle IDN queries. 73b6c3722Schristos 8*0cd9f4ecSchristosAutomatic IDN DNAME conversion 9*0cd9f4ecSchristos------------------------------- 10*0cd9f4ecSchristos 11*0cd9f4ecSchristosIf we use unicode string in :meth:`unbound.ub_ctx.resolve` method, 12*0cd9f4ecSchristosthe IDN DNAME conversion (if it is necessary) is performed on background. 13*0cd9f4ecSchristos 14*0cd9f4ecSchristosSource code 15*0cd9f4ecSchristos........... 16*0cd9f4ecSchristos 173b6c3722Schristos.. literalinclude:: example7-1.py 183b6c3722Schristos :language: python 193b6c3722Schristos 20*0cd9f4ecSchristosIDN converted attributes 21*0cd9f4ecSchristos------------------------ 22*0cd9f4ecSchristos 23*0cd9f4ecSchristosThe :class:`unbound.ub_data` class contains attributes suffix which converts 24*0cd9f4ecSchristosthe dname to UTF string. These attributes have the ``_idn`` suffix. 25*0cd9f4ecSchristos 26*0cd9f4ecSchristosApart from this approach, two conversion functions exist 27*0cd9f4ecSchristos(:func:`unbound.idn2dname` and :func:`unbound.dname2idn`). 28*0cd9f4ecSchristos 29*0cd9f4ecSchristosSource code 30*0cd9f4ecSchristos........... 313b6c3722Schristos 323b6c3722Schristos.. literalinclude:: example7-2.py 333b6c3722Schristos :language: python 34