+2008-12-09 Milan Crha <mcrha@redhat.com>
+
+ ** Part of fix for bug #552986
+
+ * camel-utf8.h: (camel_utf8_make_valid):
+ * camel-utf8.c: (camel_utf8_make_valid): New utility function.
+
2008-12-08 Jeff Cai <jeff.cai@sun.com>
* camel-db.c: (camel_db_select):
return out;
}
+
+/**
+ * camel_utf8_make_valid:
+ * @text:
+ *
+ * Ensures the returned text will be valid UTF-8 string, with incorrect letters
+ * changed to question marks. Returned pointer should be freed with g_free.
+ **/
+char *
+camel_utf8_make_valid (const char *text)
+{
+ gchar *res = g_strdup (text), *p;
+
+ if (!res)
+ return res;
+
+ p = res;
+ while (!g_utf8_validate (p, -1, (const gchar **) &p)) {
+ /* make all invalid characters appear as question marks */
+ *p = '?';
+ }
+
+ return res;
+}
char *camel_utf8_ucs2(const char *ptr);
char *camel_ucs2_utf8(const char *ptr);
+/* make valid utf8 string */
+char *camel_utf8_make_valid (const char *text);
+
G_END_DECLS
#endif /* ! _CAMEL_UTF8_H */
+2008-12-09 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #552986
+
+ * camel-pop3-store.c: (pop3_connect):
+ Ensure error description is valid UTF-8 text before using it.
+
2008-10-02 Jeffrey Stedfast <fejj@novell.com>
* camel-pop3-store.c (pop3_try_authenticate): Return -1 if we fail
#include "camel-tcp-stream-raw.h"
#include "camel-tcp-stream.h"
#include "camel-url.h"
+#include "camel-utf8.h"
#ifdef HAVE_SSL
#include "camel-tcp-stream-ssl.h"
/* we only re-prompt if we failed to authenticate, any other error and we just abort */
if (status == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE) {
- errbuf = g_markup_printf_escaped ("%s\n\n", camel_exception_get_description (ex));
+ char *tmp = camel_utf8_make_valid (camel_exception_get_description (ex));
+ errbuf = g_markup_printf_escaped ("%s\n\n", tmp);
+ g_free (tmp);
camel_exception_clear (ex);
camel_session_forget_password (session, service, NULL, "password", ex);