提交 0b408cb3 编写于 作者: J James Myatt

Store unicode codes as ASCII

Signed-off-by: NJames Myatt <james@jamesmyatt.co.uk>
上级 c0bb9edb
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Test whether a client produces a correct connect with a unicode username and password.
......@@ -13,8 +12,8 @@ import paho_test
rc = 1
keepalive = 60
username = "úsérnámé-hélló"
password = "hélló"
username = "\u00fas\u00e9rn\u00e1m\u00e9-h\u00e9ll\u00f3"
password = "h\u00e9ll\u00f3"
connect_packet = paho_test.gen_connect(
"01-unpwd-unicode-set", keepalive=keepalive, username=username, password=password)
......
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
......@@ -8,7 +7,9 @@ import paho.mqtt.client as mqtt
mqttc = mqtt.Client("01-unpwd-unicode-set")
run = -1
mqttc.username_pw_set("úsérnámé-hélló", "hélló")
username = "\u00fas\u00e9rn\u00e1m\u00e9-h\u00e9ll\u00f3"
password = "h\u00e9ll\u00f3"
mqttc.username_pw_set(username, password)
mqttc.connect("localhost", 1888)
while run == -1:
mqttc.loop()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册