Author: pluto                        Date: Mon Sep 19 01:10:18 2005 GMT
Module: SOURCES                       Tag: LINUX_2_6
---- Log message:
- this patch allows you to enter any Unicode value using
  the Alt-nnnn mechanism. previously, it was restricted to the BMP,
  i.e. the first 65536 Unicode characters.

---- Files affected:
SOURCES:
   linux-2.6-extended-utf8.patch (NONE -> 1.1.2.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/linux-2.6-extended-utf8.patch
diff -u /dev/null SOURCES/linux-2.6-extended-utf8.patch:1.1.2.1
--- /dev/null   Mon Sep 19 03:10:18 2005
+++ SOURCES/linux-2.6-extended-utf8.patch       Mon Sep 19 03:10:13 2005
@@ -0,0 +1,51 @@
+This patch allows you to enter any Unicode value using
+the Alt-nnnn mechanism. Previously, it was restricted to the BMP,
+i.e. the first 65536 Unicode characters.
+
+--- a/drivers/char/keyboard.c  2005-09-19 02:26:04.000000000 +0200
++++ b/drivers/char/keyboard.c  2005-09-19 03:08:39.000000000 +0200
+@@ -330,10 +330,9 @@
+  * Many other routines do put_queue, but I think either
+  * they produce ASCII, or they produce some user-assigned
+  * string, and in both cases we might assume that it is
+- * in utf-8 already. UTF-8 is defined for words of up to 31 bits,
+- * but we need only 16 bits here
++ * in utf-8 already.
+  */
+-static void to_utf8(struct vc_data *vc, ushort c)
++static void to_utf8(struct vc_data *vc, uint c)
+ {
+       if (c < 0x80)
+               /*  0******* */
+@@ -342,11 +341,21 @@
+               /* 110***** 10****** */
+               put_queue(vc, 0xc0 | (c >> 6)); 
+               put_queue(vc, 0x80 | (c & 0x3f));
+-      } else {
++      } else if (c < 0x10000) {
++              if (c >= 0xD800 && c < 0xE000)
++                      return;
++              if (c == 0xFFFF)
++                      return;
+               /* 1110**** 10****** 10****** */
+               put_queue(vc, 0xe0 | (c >> 12));
+               put_queue(vc, 0x80 | ((c >> 6) & 0x3f));
+               put_queue(vc, 0x80 | (c & 0x3f));
++      } else if (c < 0x110000) {
++              /* 11110*** 10****** 10****** 10****** */
++              put_queue(vc, 0xf0 | (c >> 18));
++              put_queue(vc, 0x80 | ((c >> 12) & 0x3f));
++              put_queue(vc, 0x80 | ((c >> 6) & 0x3f));
++              put_queue(vc, 0x80 | (c & 0x3f));
+       }
+ }
+ 
+@@ -775,7 +784,7 @@
+       /* kludge */
+       if (up_flag && shift_state != old_state && npadch != -1) {
+               if (kbd->kbdmode == VC_UNICODE)
+-                      to_utf8(vc, npadch & 0xffff);
++                      to_utf8(vc, npadch);
+               else
+                       put_queue(vc, npadch & 0xff);
+               npadch = -1;
================================================================
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to