Domain Support. RF in Biggo and Python

    A couple of days ago, following the general trend, we began to support domains. The Russian Federation, in addition, it was not difficult to do this.
    As you know, transcoding to punycode takes place on the client side, so all you had to do was recode the Cyrillic name in the forms for creating and renaming sites, as well as in the functions of working with the registrar and DNS hosting. I really liked that the possibility of transcoding is built into the language itself (Python): That is, the idna codec does everything for us. Compare with the solution in PHP =) We store domain names in the form xn - 80aswg.xn - p1ai and this works just like for other domains. You can translate back like this:

    domain_rf = u'сайт.рф'
    domain = domain_rf.encode('idna')






    domain = u'xn--80aswg.xn--p1ai'
    domain_rf = domain.decode('idna')

    Also popular now: