[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Invalid UTF-8... the comeback :-)
- From: enrique perez-terron norway online no
- To: Emmanuel Saracco <esaracco noos fr>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Invalid UTF-8... the comeback :-)
- Date: 27 Feb 2003 20:47:43 +0100
Emmanuel Saracco <esaracco@noos.fr> writes:
> hi all,
>
> how can I display caracters like "²" with gtk2?
> I always have the now famous "[Invalid UTF-8]" message...
>
> encoding my string with "g_string_append_unichar" like advised by havoc
> pennington in
> http://mail.gnome.org/archives/gtk-app-devel-list/2002-November/msg00325.html
> do nothing :-(
>
> thanks,
>
> bye
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
/*untested*/
char *
quick_n_dirty_latin_to_utf8(char *in)
{
char *out;
char *p = in;
int c, len = 0;
while (c = *p++)
if (c < 128)
len++;
else
len += 2;
p = out = g_malloc(len+1);
while (c = *in++)
if (*in < 128)
*p++ = c;
else {
*p++ = 0xc0 | (c >> 6);
*p++ = 0x80 | (c & 0x3f);
}
*p = 0;
return out;
}
There are a number of character encoding functions in GLib, you should
rather use them.
If you have gtk-doc installed,
file:///usr/share/gtk-doc/html/glib/glib-character-set-conversion.html
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]