~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to third_party/websockify/tests/utf8-list.py

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-02 13:11:51 UTC
  • Revision ID: package-import@ubuntu.com-20130502131151-q8dvteqr1ef2x7xz
Tags: upstream-1.4.1~20130504~adb56cb
ImportĀ upstreamĀ versionĀ 1.4.1~20130504~adb56cb

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
'''
 
4
Display UTF-8 encoding for 0-255.'''
 
5
 
 
6
import sys, os, socket, ssl, time, traceback
 
7
from select import select
 
8
 
 
9
sys.path.insert(0,os.path.dirname(__file__) + "/../")
 
10
from websocket import WebSocketServer
 
11
 
 
12
if __name__ == '__main__':
 
13
    print "val: hixie | hybi_base64 | hybi_binary"
 
14
    for c in range(0, 256):
 
15
        hixie = WebSocketServer.encode_hixie(chr(c))
 
16
        hybi_base64 = WebSocketServer.encode_hybi(chr(c), opcode=1,
 
17
                base64=True)
 
18
        hybi_binary = WebSocketServer.encode_hybi(chr(c), opcode=2,
 
19
                base64=False)
 
20
        print "%d: %s | %s | %s" % (c, repr(hixie), repr(hybi_base64),
 
21
                repr(hybi_binary))
 
22