stringify: add 'utf-8' type

to be used for of-wire port name etc.

Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
YAMAMOTO Takashi 2013-09-04 16:04:26 +09:00 committed by FUJITA Tomonori
parent d8f1ad7af3
commit 6b993c5e2b

View File

@ -60,8 +60,19 @@ class AsciiStringType(TypeDescr):
return v.encode('ascii')
class Utf8StringType(TypeDescr):
@staticmethod
def encode(v):
return unicode(v, 'utf-8')
@staticmethod
def decode(v):
return v.encode('utf-8')
_types = {
'ascii': AsciiStringType,
'utf-8': Utf8StringType,
}