[Xfce4-commits] <postler:master> Enforce UTF-8 when sending subjects through DBus

Christian Dywan noreply at xfce.org
Wed Jul 6 19:38:03 CEST 2011


Updating branch refs/heads/master
         to 325fee9f952934342a3ee9128e788487c0aeadcb (commit)
       from a0c342ee7c4cae2019b1938134a36dc4048ff27e (commit)

commit 325fee9f952934342a3ee9128e788487c0aeadcb
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Jul 6 01:53:04 2011 +0200

    Enforce UTF-8 when sending subjects through DBus

 postler/postler-message.vala  |    3 ++-
 postler/postler-messages.vala |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/postler/postler-message.vala b/postler/postler-message.vala
index 3234cf6..b82311c 100644
--- a/postler/postler-message.vala
+++ b/postler/postler-message.vala
@@ -128,7 +128,8 @@ namespace Postler {
             message_data.insert ("id", this.id);
             message_data.insert ("uri", this.uri ?? "");
             message_data.insert ("replies", this.replies);
-            message_data.insert ("subject", this.subject ?? "");
+            /* Enforce UTF-8 here, GLib.Variant otherwise crashes */
+            message_data.insert ("subject", Postler.Messages.fallback_to_utf8 (subject ?? ""));
             message_data.insert ("sender", this.sender ?? "");
             if (avatar != null)
                 message_data.insert ("avatar", avatar.get_uri ());
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index acd1955..079c0c0 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -42,7 +42,7 @@ public class Postler.Messages : Gtk.TreeView {
             selected_message = null;
     }
 
-    static string fallback_to_utf8 (string text) {
+    internal static string fallback_to_utf8 (string text) {
         var fallback = new StringBuilder.sized (text.size () * 2);
         for (unowned string s = text; s.get_char () != 0 ; s = s.next_char ()) {
             unichar character = s.get_char ();



More information about the Xfce4-commits mailing list