Re: problem with python, gtk and utf8

2010-10-04 Thread Thomas Perl
Hi!

2010/10/3  pelt...@gmail.com:
 and the dict(?!?) is like this:
 letters = {}
            letters['1'] = ['', '.', ',', '?', '!', '1', '@', '-', '_', '(', 
 ')', ':', ';', '', '%', '*', '#', '+', '', '=', '', '$', '£', '§', '¥']
            letters['2'] = ['', 'a', 'b', 'c', '2', 'å', u'ä']
 [...]
 and the appropriate char from that is written with:
 self.message_buffer.set_text(updatedtext)

Can you construct a minimal example that demonstrates the bug? Maybe
you're mixing str objects with unicode objects? What happens if you
use 'ä' (a str with utf-8 as encoding) instead of u'ä' (a unicode
object representing 'ä') in that code? What is the class of
self.message_object, and how do you compose updatedtext? What does
repr(updatedtext) give when printed before the affected line? If it's
a gtk.TextBuffer, maybe you want to use
self.message_buffer.insert(self.message_buffer.get_end_iter(),
new_char) or self.message_buffer.insert_at_cursor(new_char) instead?

HTH.
Thomas
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers


problem with python, gtk and utf8

2010-10-03 Thread peltsip
Hi!

I am having a problem with dict(?!?)
the code starts with:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

and the dict(?!?) is like this:
letters = {}
letters['1'] = ['', '.', ',', '?', '!', '1', '@', '-', '_', '(', 
')', ':', ';', '', '%', '*', '#', '+', '', '=', '', '$', '£', '§', '¥']
letters['2'] = ['', 'a', 'b', 'c', '2', 'å', u'ä']

etc.

and the appropriate char from that is written with:
self.message_buffer.set_text(updatedtext)

everything works perfectly until it is turn for ä to appear (to be written with 
set text above). after that there is a error:
GtkWarning: gtk_text_buffer_emit_insert: assertion `g_utf8_validate (text, len, 
NULL)' failed


does anyone have an idea what I am doing wrong?

whole source can be found at gitorious if needed (except char ä etc)
http://gitorious.org/vertsms

any help is appreciated!

Ossipena / TimoP
___
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers