Changeset 4774


Ignore:
Timestamp:
Mar 4, 2011 5:45:10 PM (4 years ago)
Author:
alxf
Message:
  • Fixed utf32_to_utf8 function.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/python/caca/common.py

    r4398 r4774  
    276276        ch  -- the character to convert
    277277    """
    278     _lib.caca_utf8_to_utf32.argtypes = [ctypes.c_char_p, ctypes.POINTER(ctypes.c_size_t)]
     278    _lib.caca_utf8_to_utf32.argtypes = [ctypes.c_char_p,
     279            ctypes.POINTER(ctypes.c_size_t)
     280        ]
    279281    _lib.caca_utf8_to_utf32.restype  = ctypes.c_uint32
    280282
     
    289291    _lib.caca_utf32_to_utf8.restype  = ctypes.c_int
    290292
    291     buf = ctypes.c_buffer(2)
     293    buf = ctypes.c_buffer(7)
    292294    _lib.caca_utf32_to_utf8(buf, ch)
    293295
    294     return buf
     296    return buf.raw.rstrip('\x00')
    295297
    296298def utf32_to_cp437(ch):
Note: See TracChangeset for help on using the changeset viewer.