]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - libunbound/python/doc/examples/example7.rst
import unbound 1.6.0
[FreeBSD/FreeBSD.git] / libunbound / python / doc / examples / example7.rst
1 .. _example_idna:
2
3 Internationalized domain name support
4 =====================================
5
6 Unlike the libUnbound, pyUnbound is able to handle IDN queries.
7
8 Automatic IDN DNAME conversion
9 -------------------------------
10
11 If we use unicode string in :meth:`unbound.ub_ctx.resolve` method,
12 the IDN DNAME conversion (if it is necessary) is performed on background.
13
14 Source code
15 ...........
16
17 .. literalinclude:: example7-1.py
18     :language: python
19
20 IDN converted attributes
21 ------------------------
22
23 The :class:`unbound.ub_data` class contains attributes suffix which converts
24 the dname to UTF string. These attributes have the ``_idn`` suffix.
25
26 Apart from this aproach, two conversion functions exist
27 (:func:`unbound.idn2dname` and :func:`unbound.dname2idn`).
28
29 Source code
30 ...........
31
32 .. literalinclude:: example7-2.py
33     :language: python