[dev] [PATCH] Made terminal title support UTF-8 strings.

From: Alexander Sedov <alex0player_AT_gmail.com>
Date: Thu, 21 Feb 2013 01:02:40 +0400

From: Alexander Sedov <elec.lomy.ru_AT_gmail.com>

---
 TODO |    1 -
 st.c |   14 +++++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/TODO b/TODO
index 2f42720..67615f8 100644
--- a/TODO
+++ b/TODO
_AT_@ -18,7 +18,6 @@ bugs
 
 * fix shift up/down (shift selection in emacs)
 * fix selection paste for xatom STRING
-* fix umlaut handling in settitle
 * fix rows and column definition in fixed geometry
 * fix -e handling
 * remove DEC test sequence when appropriate
diff --git a/st.c b/st.c
index 300e5ec..5c26d22 100644
--- a/st.c
+++ b/st.c
_AT_@ -1858,6 +1858,7 @@ csireset(void) {
 void
 strhandle(void) {
 	char *p;
+	XTextProperty prop;
 
 	/*
 	 * TODO: make this being useful in case of color palette change.
_AT_@ -1872,15 +1873,18 @@ strhandle(void) {
 		case '0':
 		case '1':
 		case '2':
-			/*
-			 * TODO: Handle special chars in string, like umlauts.
-			 */
 			if(p[1] == ';') {
-				XStoreName(xw.dpy, xw.win, strescseq.buf+2);
+				p += 2;
+				Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
+						&prop);
+                XSetWMName(xw.dpy, xw.win, &prop);                              
 			}
 			break;
 		case ';':
-			XStoreName(xw.dpy, xw.win, strescseq.buf+1);
+			p += 1;
+			Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
+					&prop);
+			XSetWMName(xw.dpy, xw.win, &prop);                              
 			break;
 		case '4': /* TODO: Set color (arg0) to "rgb:%hexr/$hexg/$hexb" (arg1) */
 			break;
-- 
1.7.10.4
Received on Wed Feb 20 2013 - 22:02:40 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 21 2013 - 19:25:18 CET