Commit feb4158a by hank

修改bigunicode

parent 37fa3bbc
...@@ -20,7 +20,16 @@ books = [ ...@@ -20,7 +20,16 @@ books = [
name='zwhset', city='beijing' name='zwhset', city='beijing'
)) ))
] ]
def getBigUnicode(str):
b = bytes(str,'utf-8').decode().encode('utf-16be')
arr = [[0]*(4+len(b))][0]
arr[0] = 66
arr[1] = 69
arr[2] = 85
arr[3] = 67
for index in range(len(b)):
arr[index+4] = b[index]
return bytes(arr)
def sendMessage(path, message): def sendMessage(path, message):
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
...@@ -33,12 +42,7 @@ def sendMessage(path, message): ...@@ -33,12 +42,7 @@ def sendMessage(path, message):
client = udp_client.SimpleUDPClient(args.ip, args.port) client = udp_client.SimpleUDPClient(args.ip, args.port)
print(path, message) print(path, message)
print(path.encode('unicode_escape'), message) client.send_message(path, message)
print(('BEUC' + path).encode('unicode_escape'), message)
str = ('BEUC' + path).encode('unicode_escape').decode('utf-8')
print('BEUC' + path, str)
print(str.encode('unicode_escape')[0], str.encode('unicode_escape')[1], str.encode('unicode_escape')[2], str.encode('unicode_escape')[3], str.encode('unicode_escape')[4])
client.send_message(str, json.dumps(message))
# error action # error action
...@@ -98,7 +102,8 @@ def create_ctr(): ...@@ -98,7 +102,8 @@ def create_ctr():
print(request.json) print(request.json)
# print(data) # print(data)
result = request.json result = request.json
sendMessage(request.json['path'], request.json['arguments']) print([getBigUnicode(request.json['path'])].extend(request.json['arguments']))
sendMessage('/route',[getBigUnicode(request.json['path']), 0 ,1])
return jsonify(code=0, message='success', data = request.json) return jsonify(code=0, message='success', data = request.json)
if __name__ == '__main__': if __name__ == '__main__':
app.run(host=localIP, port=8900) app.run(host=localIP, port=8900)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment