Skip to content

Instantly share code, notes, and snippets.

@NEJmark
NEJmark / uao_decode.py
Last active December 9, 2021 13:14 — forked from andycjw/uao_decode.py
Big5 UAO decodeusage: just do 'import uao_decode.py'unicode_string = big5_string.decode('uao_decode')
# -*- coding: utf-8 -*-
import codecs
import struct
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
u'''
## for example:
## 1. u'築'= \u7bc9, 7bc9(16 進位) = 31689(10進位)
## 2. '築'= '\xbfv'='\xbf\x76'('v'=='\x76'), bf76(16 進位) = 49014