UTF-7 encoded unsigned integer
Project description
Encoder/decoder of an UTF-7 encoded unsigned integer.
>>> utf7.pack_bytes(65535)
b'\xff\xff\x03'
>>> utf7.unpack_bytes(b'\xff\xff\x03')
65535
UTF-7 uint is used for BinaryWriter.Write(String) in Microsoft .NET Framework. Here’s an example of ping-pong between Python server and C# client:
while not socket.closed:
# recv ping
ping_size = utf7.unpack_socket(socket)
ping_data = socket.recv(ping_size)
assert ping_data == b'ping'
# send pong
pong_data = b'pong'
pong_size = len(pong_data)
utf7.pack_socket(pong_size, socket)
socket.send(pong_data)
Links
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
utf7-0.9.2.tar.gz
(3.5 kB
view details)
File details
Details for the file utf7-0.9.2.tar.gz
.
File metadata
- Download URL: utf7-0.9.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f9e7ca6af5afd256e28e323c8a0eebf3efc47730cc60c3388db847c4be318ef |
|
MD5 | 3ea3fc3ac212a67d8080cea05f650f2e |
|
BLAKE2b-256 | 879f93875395526e063d1d561e969ee240b67d9c958ac4468c7b77afc11190f2 |