summaryrefslogtreecommitdiff
path: root/Source/Kernel/Library/wchar.class.cpp
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2009-08-31 00:25:21 +0200
committerAlexis211 <alexis211@gmail.com>2009-08-31 00:25:21 +0200
commit68a8fb4e3b3e9087904b17ce6d81983950b9dca9 (patch)
tree57518642ab813fddfb3887a47f7a01d839d9bb70 /Source/Kernel/Library/wchar.class.cpp
parent9ad8e2fe0242da26dae7fca2b180640637c8c062 (diff)
downloadMelon-68a8fb4e3b3e9087904b17ce6d81983950b9dca9.tar.gz
Melon-68a8fb4e3b3e9087904b17ce6d81983950b9dca9.zip
We now have complete support for keybord, IN UTF-8 !!
Diffstat (limited to 'Source/Kernel/Library/wchar.class.cpp')
-rw-r--r--Source/Kernel/Library/wchar.class.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/Kernel/Library/wchar.class.cpp b/Source/Kernel/Library/wchar.class.cpp
index acf5392..3a2ef92 100644
--- a/Source/Kernel/Library/wchar.class.cpp
+++ b/Source/Kernel/Library/wchar.class.cpp
@@ -42,6 +42,10 @@ void wchar::affectAscii(char c) {
}
u32int wchar::affectUtf8(char* c) { //Returns the number of bytes for the character
+ /*if ((c[0] & 0xB0) == 0x80) { //11000000b == 10000000b, means we are IN a sequence
+ value = 0;
+ return 1;
+ }*/
if ((c[0] & 0x80) == 0) {
value = c[0]; //0x80 = 10000000b
return 1;
@@ -54,6 +58,8 @@ u32int wchar::affectUtf8(char* c) { //Returns the number of bytes for the charac
if ((c[0] & 0xF0) == 0xE0) { // 11110000b, 11100000b
value = ((c[0] & 0x0F) << 12) | ((c[1] & 0x3F) << 6) | (c[2] & 0x3F);
if (value < 2048) value = 0; //Bad value
+ if (value >= 0xD800 and value <= 0xDFFF) value = 0; //These values are unallowed
+ if (value >= 0xFFFE and value <= 0xFFFF) value = 0;
return 3;
}
if ((c[0] & 0xF8) == 0xF0) { // 11111000b, 11110000b