changeset 27886:faee69fed1c2

go back to is_zenkaku_space() due to a problem of i18n url such as ja.wikipedia.org.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 06 Sep 2008 19:13:49 +0000
parents 1e9d17432a26
children bbd148cd6866
files libpurple/util.c
diffstat 1 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/util.c	Sat Sep 06 17:35:09 2008 +0000
+++ b/libpurple/util.c	Sat Sep 06 19:13:49 2008 +0000
@@ -2006,19 +2006,14 @@
 }
 
 static gboolean
-is_multibyte_utf8(const char *c)
+is_zenkaku_space(const char *c)
 {
     gboolean rv = FALSE;
     const guchar *u = (guchar *)c;
 
-    if(!c || !strcmp(c, "") || *u <= 0x7f)
+    if(!c || !strcmp(c, "") || strlen(c) < 3)
         rv = FALSE;
-    else if(*u >= 0xc2 && *u <= 0xdf &&
-            *(u+1) >= 0x80 && *(u+1) <= 0xbf )  /* 2bytes */
-        rv = TRUE;
-    else if(*u >= 0xe0 && *u <= 0xfd &&
-            *(u+1) >= 0x80 && *(u+1) <= 0xbf &&
-            *(u+2) >= 0x80 && *(u+2) <= 0xbf)   /* 3bytes or more */
+    else if(*u == 0xe3 && *(u+1) == 0x80 && *(u+2) == 0x80)
         rv = TRUE;
 
     return rv;
@@ -2112,7 +2107,7 @@
 					(!g_ascii_strncasecmp(c, "https://", 8)))) {
 			t = c;
 			while (1) {
-				if (badchar(*t) || badentity(t) || is_multibyte_utf8(t)) {
+				if (badchar(*t) || badentity(t) || is_zenkaku_space(t)) {
 
 					if ((!g_ascii_strncasecmp(c, "http://", 7) && (t - c == 7)) ||
 						(!g_ascii_strncasecmp(c, "https://", 8) && (t - c == 8))) {
@@ -2149,7 +2144,7 @@
 			if (c[4] != '.') {
 				t = c;
 				while (1) {
-					if (badchar(*t) || badentity(t) || is_multibyte_utf8(t)) {
+					if (badchar(*t) || badentity(t) || is_zenkaku_space(t)) {
 						if (t - c == 4) {
 							break;
 						}
@@ -2183,7 +2178,7 @@
 		} else if (!g_ascii_strncasecmp(c, "ftp://", 6) || !g_ascii_strncasecmp(c, "sftp://", 7)) {
 			t = c;
 			while (1) {
-				if (badchar(*t) || badentity(t) || is_multibyte_utf8(t)) {
+				if (badchar(*t) || badentity(t) || is_zenkaku_space(t)) {
 
 					if ((!g_ascii_strncasecmp(c, "ftp://", 6) && (t - c == 6)) ||
 						(!g_ascii_strncasecmp(c, "sftp://", 7) && (t - c == 7))) {
@@ -2216,7 +2211,7 @@
 			if (c[4] != '.') {
 				t = c;
 				while (1) {
-					if (badchar(*t) || badentity(t) || is_multibyte_utf8(t)) {
+					if (badchar(*t) || badentity(t) || is_zenkaku_space(t)) {
 						if (t - c == 4) {
 							break;
 						}
@@ -2246,7 +2241,7 @@
 		} else if (!g_ascii_strncasecmp(c, "mailto:", 7)) {
 			t = c;
 			while (1) {
-				if (badchar(*t) || badentity(t) || is_multibyte_utf8(t)) {
+				if (badchar(*t) || badentity(t) || is_zenkaku_space(t)) {
 					char *d;
 					if (t - c == 7) {
 						break;
@@ -2280,7 +2275,7 @@
 				   (c == text || badchar(c[-1]) || badentity(c-1))) {
 			t = c;
 			while (1) {
-				if (badchar(*t) || badentity(t) || is_multibyte_utf8(t)) {
+				if (badchar(*t) || badentity(t) || is_zenkaku_space(t)) {
 
 					if (t - c == 5) {
 						break;