How can I convert a string to the idna coded, encoding with 'idna' coded failed

蹲街弑〆低调 提交于 2020-01-25 10:17:12

问题


I have a string, which should be a stmp server in a later step for python.

The string is (little anonymized):

outlook-stg.d-a-tf.de/mapi/emsmdb/?MailboxId=cf27be4f-8605-40e4-94ab-d8cea3cc03bc@test.com

For sure the error is:

UnicodeError: encoding with 'idna' codec failed (UnicodeError: label empty or too long)

Which I understand is a problem with the name how I want to adress the server: label empty or too long - python urllib2

But how can I convert it in the right format? I also tried: Encoding with 'idna' codec failed in RethinkDB

With this code: .encode("idna") but this also is the same error.

来源:https://stackoverflow.com/questions/59155219/how-can-i-convert-a-string-to-the-idna-coded-encoding-with-idna-coded-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!