hello, I am making a file program that will read the values from the file and add it to the list and allows the user to select the value from the list and display it in the text. Now i am encrypting my values which will look like this ''?x h???f with the special characters generated randomly and using the g_convert() function to convert it to UTF8. Now once i reload the file and select the encrypted value it gives me this error..This is the function that i am using for conversion..
gchar *convert_utf_string(char *t) { static gchar *s = NULL; GError *error = NULL; gsize r_bytes, w_bytes; unsigned char *c; const char *fc; gchar *from_codeset="ISO-8859-1"; if(!t) g_assert_not_reached(); if (g_utf8_validate (t,-1,NULL)) return t; /* so we got a non-UTF-8 */ g_get_charset(&fc); if (fc) from_codeset = g_strdup(fc); else from_codeset = g_strdup("ISO-8859-1"); if (!strcmp(from_codeset,"ISO-")) { g_free(from_codeset); from_codeset = g_strdup("ISO-8859-1"); } if(s) g_free(s); for(c = (unsigned char *)t; *c != 0; c++) if(*c < 32 && *c != '\n') *c = ' '; s = g_convert (t,strlen(t),"UTF-8",from_codeset,&r_bytes, &w_bytes,&error); g_free(from_codeset); if(!s) { s=g_strdup(t); for(c = s; *c != 0; c++) if(*c > 128) *c = '?'; } if(error){ printf("ERR: %s. Codeset for system is: %s\n", error->message,from_codeset); g_error_free(error); } return s; } This is the snipplet that i am using ...For the special characters like this as shown above i am intended to use the ISO-8859-1 right ??? Where am i going wrong please help me solve this problem... Thanks. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list