Changeset 4769 for libcaca


Ignore:
Timestamp:
Feb 13, 2011, 5:39:13 PM (8 years ago)
Author:
Alex Foulon
Message:
  • Fix get_key_utf8 method, return python string with utf8 char now.
File:
1 edited

Legend:

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

    r4411 r4769  
    220220
    221221    def get_key_utf8(self):
    222         """ Return a key press or key release event's UTF-8 value.
     222        """ Return a key press or key release event's UTF-8 value
     223            as python string.
    223224        """
    224225        # set buffer for writing utf8 value
     
    230231        _lib.caca_get_event_key_utf8(self, buf)
    231232
    232         return buf
     233        raw = []
     234        for item in list(buf.raw):
     235            if item == '\x00':
     236                break
     237            else:
     238                raw.append(item)
     239
     240        return "".join(raw)
    233241
    234242    def get_mouse_button(self):
Note: See TracChangeset for help on using the changeset viewer.