Changeset 78
- Timestamp:
- 06/02/15 13:33:02 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/bletchley/chosenct.py
r71 r78 24 24 import queue 25 25 import hashlib 26 import codecs 27 28 29 def escape_handler(error): 30 ret_val = '' 31 for b in error.object[error.start:error.end]: 32 ret_val += "\\x%.2X" % b 33 34 return (ret_val,error.end) 35 36 codecs.register_error('decode_escape',escape_handler) 37 26 38 27 39 # Wish Python had a better function for this that escaped more characters 28 40 _html_escape_table = { 29 "&": "&",30 '"': """,31 "'": "'",32 ">": ">",33 "<": "<",34 "\n": "
 ",35 "\r": "
 ",41 "&": "&", 42 '"': """, 43 "'": "'", 44 ">": ">", 45 "<": "<", 46 "\n": "
", 47 "\r": "
", 36 48 } 37 49 … … 99 111 bg,fg = self._generate_colors(message) 100 112 if not isinstance(message, str): 101 message = message.decode('utf-8' )113 message = message.decode('utf-8', 'decode_escape') 102 114 103 115 truncated = message[0:maxlen]
Note: See TracChangeset
for help on using the changeset viewer.