[balsa/gtk3] Sanitize UTF-8 text for WebKit2
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Sanitize UTF-8 text for WebKit2
- Date: Wed, 3 Apr 2013 01:36:28 +0000 (UTC)
commit 8b6c440496959a2ed9addabdf3f22c207a821e95
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Tue Apr 2 21:35:35 2013 -0400
Sanitize UTF-8 text for WebKit2
* libbalsa/html.c (lbh_get_body_content_utf8): sanitize UTF-8
text.
ChangeLog | 5 +++++
libbalsa/html.c | 15 ++++++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b77b2cf..48c936a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-02 Peter Bloomfield
+
+ * libbalsa/html.c (lbh_get_body_content_utf8): sanitize UTF-8
+ text.
+
2013-03-31 Peter Bloomfield
Do not leak search-text
diff --git a/libbalsa/html.c b/libbalsa/html.c
index a14f149..b0caf92 100644
--- a/libbalsa/html.c
+++ b/libbalsa/html.c
@@ -130,13 +130,18 @@ lbh_get_body_content_utf8(LibBalsaMessageBody * body,
if (charset) {
*utf8_text = g_convert(text, len, "UTF-8", charset,
NULL, &utf8_len, NULL);
- g_free(text);
- } else {
- *utf8_text = text;
- utf8_len = len;
+ if (*utf8_text) {
+ /* Success! */
+ g_free(text);
+ return utf8_len;
+ }
}
- return utf8_len;
+ /* No charset, or g_convert failed; just make sure it's UTF-8 */
+ libbalsa_utf8_sanitize(&text, TRUE, NULL);
+ *utf8_text = text;
+
+ return strlen(text);
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]