stumpwm-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[STUMP] Stumpwm crashes when there is incorrect utf-8 in windows title


From: Alexey Lebedeff
Subject: [STUMP] Stumpwm crashes when there is incorrect utf-8 in windows title
Date: Wed, 18 Jun 2008 19:04:36 +0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

The app that created incorrect title was Licq. 
I made a small change in sbcl variant, so now invalid utf-8 is ignored.

It's not perfect, because it replaces whole title with "<Invalid>" when
encounters incorrect utf-8, but this is enough for me.



diff --git a/wrappers.lisp b/wrappers.lisp
index 8fad995..c5ef072 100644
--- a/wrappers.lisp
+++ b/wrappers.lisp
@@ -193,9 +193,13 @@
 
 (defun utf8-to-string (octets)
   "Convert the list of octets to a string."
-  #+sbcl (sb-ext:octets-to-string
-          (coerce octets '(vector (unsigned-byte 8)))
-          :external-format :utf-8)
+  #+sbcl (let (result)
+                  (ignore-errors (setf result (sb-ext:octets-to-string
+                                                                               
(coerce octets '(vector (unsigned-byte 8)))
+                                                                               
:external-format :utf-8)))
+                  (unless result
+                        (setf result "<Invalid>"))
+                  result)
   #+clisp (ext:convert-string-from-bytes (coerce octets '(vector 
(unsigned-byte 8)))
                                          charset:utf-8)
   #-(or sbcl clisp)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]