diff --git a/lib/textbringer/window.rb b/lib/textbringer/window.rb
index <HASH>..<HASH> 100644
--- a/lib/textbringer/window.rb
+++ b/lib/textbringer/window.rb
@@ -687,6 +687,8 @@ module Textbringer
       else
         "U+%04X" % c.ord
       end
+    rescue ArgumentError
+      "0x" + c.unpack("H*")[0]
     end
 
     def escape(s)
rescue from ArgumentError by String#ord