diff -ur gaim-0.77-orig/src/protocols/oscar/oscar.c gaim-0.77/src/protocols/oscar/oscar.c --- gaim-0.77-orig/src/protocols/oscar/oscar.c 2004-04-22 04:53:15.000000000 +0300 +++ gaim-0.77/src/protocols/oscar/oscar.c 2004-05-22 15:50:29.000000000 +0300 @@ -410,6 +410,48 @@ return utf8; } +int isUTF8(char *str, size_t len) +{ + size_t i=0,tomatch; + + while (imsg || !args->msglen) return 1; - tmp = g_convert(args->msg, args->msglen, "UTF-8", "ISO-8859-1", NULL, &convlen, &err); - if (err) { - gaim_debug_info("oscar", - "ISO-8859-1 IM conversion: %s\n", err->message); - tmp = g_strdup(_("(There was an error receiving this message)")); - g_error_free(err); + if (isUTF8(args->msg, args->msglen)==0) { + tmp = g_convert(args->msg, args->msglen, "UTF-8", "CP1251", NULL, &convlen, &err); + if (err) { + gaim_debug_info("oscar", + "ISO-8859-1 IM conversion: %s\n", err->message); + tmp = g_strdup(_("(There was an error receiving this message)")); + g_error_free(err); + } + } + else + { + tmp=g_strdup(args->msg); } } @@ -2872,12 +2920,14 @@ msg2 = (gchar **)g_malloc((numtoks+1)*sizeof(gchar *)); for (i=0; msg1[i]; i++) { gaim_str_strip_cr(msg1[i]); - msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "ISO-8859-1", NULL, NULL, &err); - if (err) { - gaim_debug_error("oscar", - "Error converting a string from ISO-8859-1 to " - "UTF-8 in oscar ICBM channel 4 parsing\n"); - g_error_free(err); + if ( isUTF8(msg1[i],strlen(msg1[i]))!=0 ) { + msg2[i] = g_convert(msg1[i], strlen(msg1[i]), "UTF-8", "CP1251", NULL, NULL, &err); + if (err) { + gaim_debug_error("oscar", + "Error converting a string from ISO-8859-1 to " + "UTF-8 in oscar ICBM channel 4 parsing\n"); + g_error_free(err); + } } } msg2[i] = NULL;