File: utf8-list.py

package info (click to toggle)
websockify 0.8.0%2Bdfsg1-10
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 916 kB
  • sloc: python: 1,951; ansic: 1,037; ruby: 533; cs: 142; sh: 142; makefile: 41
file content (19 lines) | stat: -rwxr-xr-x 613 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python

'''
Display UTF-8 encoding for 0-255.'''

import sys, os, socket, ssl, time, traceback
from select import select
sys.path.insert(0,os.path.join(os.path.dirname(__file__), ".."))
from websockify.websocket import WebSocketServer

if __name__ == '__main__':
    print "val: hybi_base64 | hybi_binary"
    for c in range(0, 256):
        hybi_base64 = WebSocketServer.encode_hybi(chr(c), opcode=1,
                base64=True)
        hybi_binary = WebSocketServer.encode_hybi(chr(c), opcode=2,
                base64=False)
        print "%d: %s | %s" % (c, repr(hybi_base64), repr(hybi_binary))