text with äæ to gtk_view



Hi to all,
 
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] = '~'; }
 
I just tried to replace everything which is higher than the ~ to become a ~. I thought it would just replace stuff like this äÑô with ~.
Anyway it does not work and it would not be the best way anyway i guess.
 
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.
The text i want to show was produced on MS windows with simple texteditor like notepad, and was written afterwards with a ostrstream to a buffer. The only problem is when there are stuff like ç in the text. I guess it's ASCII text. US-ASCII..hmm
 
Sorry it's the first time i'm in conctact with stuff like this, it seems i can't help myself so far nor have i found something for newbies in the archives.
I would be glad when anybody could say me where to find a piece of code from which i could learn, or where to educate myself or give me some hints.
 
thanks a lot
calmar  
 
 
 
 
 
 
 









 



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