Mercurial > pidgin
comparison src/util.c @ 3642:5e50f6746509
[gaim-migrate @ 3766]
(10:16:03) deryni: we're fully 'compliant'? (sorry if that betrays some underlying stupidity)
(10:16:55) Paco-Paco: yes
(10:17:24) Paco-Paco: provided the user has the font, on any of the services supporting unicode we should support every known language in the world :-)
(10:17:36) Paco-Paco: well, as soon as we have a proper utf-8 input widget
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Fri, 11 Oct 2002 14:19:24 +0000 |
parents | 9682c0e022c6 |
children | f09193608fd3 |
comparison
equal
deleted
inserted
replaced
3641:e2391338c394 | 3642:5e50f6746509 |
---|---|
1171 } | 1171 } |
1172 | 1172 |
1173 fclose(fd); | 1173 fclose(fd); |
1174 } | 1174 } |
1175 | 1175 |
1176 char *convert_string(char *str, const char *destset, const char *srcset) | |
1177 { | |
1178 #ifdef HAVE_ICONV | |
1179 char *buf; | |
1180 iconv_t cd; | |
1181 size_t insize = 0; | |
1182 size_t outsize = 0; | |
1183 size_t nconv = 0; | |
1184 char *inptr; | |
1185 char *outptr; | |
1186 char *ret; | |
1187 | |
1188 if (!str) | |
1189 return NULL; | |
1190 buf = g_malloc(strlen(str)*4); | |
1191 insize = strlen(str); | |
1192 inptr = str; | |
1193 outsize = strlen(str)*4; | |
1194 outptr = buf; | |
1195 | |
1196 cd = iconv_open(destset, srcset); | |
1197 if (cd == (iconv_t) -1) { | |
1198 g_free(buf); | |
1199 debug_printf("iconv_open(%s, %s) Error\n",destset, srcset); | |
1200 return g_strdup(str); | |
1201 } | |
1202 | |
1203 nconv = iconv(cd, &inptr, &insize, &outptr, &outsize); | |
1204 if (nconv == (size_t) -1) { | |
1205 debug_printf("iconv Error\n"); | |
1206 g_free(buf); | |
1207 return g_strdup(str); | |
1208 } | |
1209 *outptr = '\0'; | |
1210 iconv_close(cd); | |
1211 | |
1212 ret = g_strdup(buf); | |
1213 g_free(buf); | |
1214 | |
1215 return ret; | |
1216 #else | |
1217 return g_strdup(str); | |
1218 #endif | |
1219 } | |
1220 | |
1221 void strip_linefeed(gchar *text) | 1176 void strip_linefeed(gchar *text) |
1222 { | 1177 { |
1223 int i, j; | 1178 int i, j; |
1224 gchar *text2 = g_malloc(strlen(text) + 1); | 1179 gchar *text2 = g_malloc(strlen(text) + 1); |
1225 | 1180 |