Re: text with äæ to gtk_view



Hi,

"calmar" <mac calmar ws> writes:

> i'm still trying to put the some text with 'gtk_text_buffer_set_text' to a 'gtk_text_view', but i can't succeed so far (due to ä and similar characters).
> 
> my last try was something like this:
> for (int z=0 ; z<lenghtofstring ;z++){   if ( (char)pstring[z] > (char) '~' ) pstring[z] = '~'; }

that won't work since char is a signed type so all chars outside the ASCII
range of 0 to 127 have negative values and are thus smaller than '~'.

> As far as i figured out I should use :
> g_convert or g_locale_to_utf8
> 
> ( gchar *) baus = g_convert(buffl, lengh_to_translate,"ascii","utf-8", u, l, erro);
> or
> (gchar *) haus =g_locale_to_utf8((gchar*) buffl, lengh_to_translate, u, l, erro);
> 
> So both did not work unfortunately.
> So in the first case, i guess 'ascii' is wrong anyway.

yep, "ascii" is the wrong choice indeed. Most probably your text is encoded
as ISO-8859-1 (sometimes also referred to as latin1) or ISO-8859-15 (which
is an extended version of ISO-8859-1 that has the Euro symbol).


Salut, Sven



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]