From 83c34c42ae6087730c81af1dd318714ddbd67422 Mon Sep 17 00:00:00 2001 From: Alex Foulon Date: Fri, 18 Feb 2011 19:03:44 +0000 Subject: [PATCH] * method Canvas.put_char now handle utf8 char. --- python/caca/canvas.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/caca/canvas.py b/python/caca/canvas.py index 329a7cd..91a25d7 100644 --- a/python/caca/canvas.py +++ b/python/caca/canvas.py @@ -16,7 +16,7 @@ import ctypes -from caca import _lib +from caca import _lib, utf8_to_utf32 from caca.font import _Font class _Canvas(object): @@ -161,7 +161,12 @@ class Canvas(_Canvas): ] _lib.caca_put_char.restype = ctypes.c_int - return _lib.caca_put_char(self, x, y, ord(ch)) + try: + ch = ord(ch) + except TypeError: + ch = utf8_to_utf32(ch) + + return _lib.caca_put_char(self, x, y, ch) def get_char(self, x, y): """ Get the Unicode character at the given coordinates.