コード例 #1
0
ファイル: __init__.py プロジェクト: OYZQ/odoo_qingjia
 def utf8_to_code(text, encoding):
     encoding = string.upper(encoding)
     if encoding == 'UTF-8':
         return text
     #Note: Pass through to wstrop.  This means we don't play nice and
     #Escape characters that are not in the target encoding.
     ws = wstring.from_utf8(text)
     text = ws.encode(encoding)
     #This version would skip all untranslatable chars: see wstrop.c
     #text = ws.encode(encoding, 1)
     return text
コード例 #2
0
ファイル: __init__.py プロジェクト: HaiVu5583/OdiSvn
 def utf8_to_code(text, encoding):
     encoding = string.upper(encoding)
     if encoding == 'UTF-8':
         return text
     #Note: Pass through to wstrop.  This means we don't play nice and
     #Escape characters that are not in the target encoding.
     ws = wstring.from_utf8(text)
     text = ws.encode(encoding)
     #This version would skip all untranslatable chars: see wstrop.c
     #text = ws.encode(encoding, 1)
     return text
コード例 #3
0
ファイル: Printer.py プロジェクト: AngusGeek/org.aspectj
 def utf8_to_code(text, encoding):
     encoding = string.upper(encoding)
     if encoding == 'UTF-8':
         return text
     from xml.unicode.iso8859 import wstring
     wstring.install_alias('ISO-8859-1', 'ISO_8859-1:1987')
     #Note: Pass through to wstrop.  This means we don't play nice and
     #Escape characters that are not in the target encoding.
     ws = wstring.from_utf8(text)
     text = ws.encode(encoding)
     #This version would skip all untranslatable chars: see wstrop.c
     #text = ws.encode(encoding, 1)
     return text
コード例 #4
0
ファイル: Printer.py プロジェクト: carvalhomb/tsmells
 def utf8_to_code(text, encoding):
     encoding = string.upper(encoding)
     if encoding == 'UTF-8':
         return text
     from xml.unicode.iso8859 import wstring
     wstring.install_alias('ISO-8859-1', 'ISO_8859-1:1987')
     #Note: Pass through to wstrop.  This means we don't play nice and
     #Escape characters that are not in the target encoding.
     ws = wstring.from_utf8(text)
     text = ws.encode(encoding)
     #This version would skip all untranslatable chars: see wstrop.c
     #text = ws.encode(encoding, 1)
     return text