mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-04 20:06:09 +02:00
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:
parent
d8f1ad7af3
commit
6b993c5e2b
@ -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,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user