From: Mathieu Trudel-Lapierre <mathieu.trudel-lapierre@canonical.com>
Subject: Properly convert an access point SSID into a format that can be displayed.

Use nm_utils_ssid_to_utf8() as used elsewhere in the code, rather than using
nm_utils_escape_ssid() (which doesn't in fact convert into an UTF8 string), so
that we have something sane that can be passed to g_markup_escape_text().

---
 panels/network/net-device-wifi.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

Index: b/panels/network/net-device-wifi.c
===================================================================
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -140,7 +140,8 @@ add_access_point (NetDeviceWifi *device_
 {
         const GByteArray *ssid;
         const gchar *object_path;
-        const gchar *ssid_text;
+        const gchar *ssid_tmp;
+        gchar *ssid_text;
         gboolean is_active_ap;
         gchar *title;
         GtkListStore *liststore_network;
@@ -150,7 +151,8 @@ add_access_point (NetDeviceWifi *device_
         ssid = nm_access_point_get_ssid (ap);
         if (ssid == NULL)
                 return;
-        ssid_text = nm_utils_escape_ssid (ssid->data, ssid->len);
+        ssid_tmp = nm_utils_escape_ssid (ssid->data, ssid->len);
+        ssid_text = nm_utils_ssid_to_utf8 (ssid);
         title = g_markup_escape_text (ssid_text, -1);
 
         is_active_ap = active && nm_utils_same_ssid (ssid, nm_access_point_get_ssid (active), TRUE);
@@ -163,7 +165,7 @@ add_access_point (NetDeviceWifi *device_
                                            -1,
                                            COLUMN_ACCESS_POINT_ID, object_path,
                                            COLUMN_TITLE, title,
-                                           COLUMN_SORT, ssid_text,
+                                           COLUMN_SORT, ssid_tmp,
                                            COLUMN_STRENGTH, nm_access_point_get_strength (ap),
                                            COLUMN_MODE, nm_access_point_get_mode (ap),
                                            COLUMN_SECURITY, get_access_point_security (ap),
@@ -172,6 +174,7 @@ add_access_point (NetDeviceWifi *device_
                                            COLUMN_AP_OUT_OF_RANGE, FALSE,
                                            COLUMN_AP_IS_SAVED, FALSE,
                                            -1);
+        g_free (ssid_text);
         g_free (title);
 }
 
@@ -519,7 +522,7 @@ add_saved_connection (NetDeviceWifi *dev
 {
         const GByteArray *ssid;
         const gchar *id;
-        const gchar *ssid_text;
+        gchar *ssid_text;
         gchar *title;
         GtkListStore *store;
         GtkTreeIter iter;
@@ -531,7 +534,7 @@ add_saved_connection (NetDeviceWifi *dev
                 return;
 
         ssid = nm_setting_wireless_get_ssid (NM_SETTING_WIRELESS (setting));
-        ssid_text = nm_utils_escape_ssid (ssid->data, ssid->len);
+        ssid_text = nm_utils_ssid_to_utf8 (ssid);
         title = g_markup_escape_text (ssid_text, -1);
         g_debug ("got saved %s", title);
 
@@ -559,6 +562,7 @@ add_saved_connection (NetDeviceWifi *dev
                                                    COLUMN_AP_IS_SAVED, TRUE,
                                                    -1);
         g_free (title);
+        g_free (ssid_text);
 }
 
 static void
@@ -1654,7 +1658,7 @@ connect_wifi_network (NetDeviceWifi *dev
         gtk_tree_model_get (model, &iter,
                             COLUMN_ACCESS_POINT_ID, &ap_object_path,
                             COLUMN_CONNECTION_ID, &connection_id,
-                            COLUMN_TITLE, &ssid,
+                            COLUMN_SORT, &ssid,
                             COLUMN_AP_IN_RANGE, &ap_in_range,
                             COLUMN_MODE, &mode,
                             -1);
