From 0319420c90f28c7e3d31c80be6eb873747ed5d1a Mon Sep 17 00:00:00 2001 From: Alex Foulon Date: Fri, 4 Mar 2011 16:45:10 +0000 Subject: [PATCH] * Fixed utf32_to_utf8 function. --- python/caca/common.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/python/caca/common.py b/python/caca/common.py index d5d77f3..0efc683 100644 --- a/python/caca/common.py +++ b/python/caca/common.py @@ -275,7 +275,9 @@ def utf8_to_utf32(ch): ch -- the character to convert """ - _lib.caca_utf8_to_utf32.argtypes = [ctypes.c_char_p, ctypes.POINTER(ctypes.c_size_t)] + _lib.caca_utf8_to_utf32.argtypes = [ctypes.c_char_p, + ctypes.POINTER(ctypes.c_size_t) + ] _lib.caca_utf8_to_utf32.restype = ctypes.c_uint32 return _lib.caca_utf8_to_utf32(ch, ctypes.c_ulong(0)) @@ -288,10 +290,10 @@ def utf32_to_utf8(ch): _lib.caca_utf32_to_utf8.argtypes = [ctypes.c_char_p, ctypes.c_uint32] _lib.caca_utf32_to_utf8.restype = ctypes.c_int - buf = ctypes.c_buffer(2) + buf = ctypes.c_buffer(7) _lib.caca_utf32_to_utf8(buf, ch) - return buf + return buf.raw.rstrip('\x00') def utf32_to_cp437(ch): """ Convert a UTF-32 character to CP437.