hirokawa Mon Sep 24 11:50:55 2007 UTC
Modified files:
/php-src/ext/mbstring/libmbfl/mbfl mbfilter.h mbfl_convert.c
/php-src/ext/mbstring mbstring.c
Log:
added support "entity" as substitute_character settin accoding to bug #39404
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h?r1=1.6&r2=1.7&diff_format=u
Index: php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h
diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.6
php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.7
--- php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h:1.6 Tue Mar 21 02:11:55 2006
+++ php-src/ext/mbstring/libmbfl/mbfl/mbfilter.h Mon Sep 24 11:50:54 2007
@@ -104,6 +104,7 @@
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE 0
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR 1
#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG 2
+#define MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY 3
/*
* buffering converter
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c?r1=1.7&r2=1.8&diff_format=u
Index: php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c
diff -u php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.7
php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.8
--- php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c:1.7 Thu Dec 21
17:37:53 2006
+++ php-src/ext/mbstring/libmbfl/mbfl/mbfl_convert.c Mon Sep 24 11:50:54 2007
@@ -386,9 +386,14 @@
ret = (*filter->filter_function)(filter->illegal_substchar,
filter);
break;
case MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG:
+ case MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY:
if (c >= 0) {
if (c < MBFL_WCSGROUP_UCS4MAX) { /* unicode */
- ret = mbfl_convert_filter_strcat(filter, (const
unsigned char *)"U+");
+ if (mode_backup ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
+ ret = mbfl_convert_filter_strcat(filter, (const
unsigned char *)"U+");
+ } else { /* entity */
+ ret = mbfl_convert_filter_strcat(filter, (const
unsigned char *)"&#");
+ }
} else {
if (c < MBFL_WCSGROUP_WCHARMAX) {
m = c & ~MBFL_WCSPLANE_MASK;
@@ -432,6 +437,9 @@
if (m == 0 && ret >= 0) {
ret =
(*filter->filter_function)(mbfl_hexchar_table[0], filter);
}
+ if (mode_backup ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ ret = mbfl_convert_filter_strcat(filter,
(const unsigned char *)";");
+ }
}
}
break;
http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.270&r2=1.271&diff_format=u
Index: php-src/ext/mbstring/mbstring.c
diff -u php-src/ext/mbstring/mbstring.c:1.270
php-src/ext/mbstring/mbstring.c:1.271
--- php-src/ext/mbstring/mbstring.c:1.270 Thu Jul 12 15:28:37 2007
+++ php-src/ext/mbstring/mbstring.c Mon Sep 24 11:50:54 2007
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: mbstring.c,v 1.270 2007/07/12 15:28:37 masugata Exp $ */
+/* $Id: mbstring.c,v 1.271 2007/09/24 11:50:54 hirokawa Exp $ */
/*
* PHP 4 Multibyte String module "mbstring"
@@ -716,6 +716,9 @@
} else if (strcasecmp("long", new_value) == 0) {
MBSTRG(filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
+ } else if (strcasecmp("entity", new_value) == 0) {
+ MBSTRG(filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
+ MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
} else {
MBSTRG(filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_CHAR;
@@ -1328,6 +1331,8 @@
RETVAL_STRING("none", 1);
} else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
RETVAL_STRING("long", 1);
+ } else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ RETVAL_STRING("entity", 1);
} else {
RETVAL_LONG(MBSTRG(current_filter_illegal_substchar));
}
@@ -1339,6 +1344,8 @@
MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_NONE;
} else if (strcasecmp("long", Z_STRVAL_PP(arg1)) == 0) {
MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG;
+ } else if (strcasecmp("entity", Z_STRVAL_PP(arg1)) ==
0) {
+ MBSTRG(current_filter_illegal_mode) =
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY;
} else {
convert_to_long_ex(arg1);
if (Z_LVAL_PP(arg1)< 0xffff && Z_LVAL_PP(arg1)>
0x0) {
@@ -3905,6 +3912,8 @@
add_assoc_string(return_value, "substitute_character",
"none", 1);
} else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
add_assoc_string(return_value, "substitute_character",
"long", 1);
+ } else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ add_assoc_string(return_value, "substitute_character",
"entity", 1);
} else {
add_assoc_long(return_value, "substitute_character",
MBSTRG(current_filter_illegal_substchar));
}
@@ -3999,6 +4008,8 @@
RETVAL_STRING("none", 1);
} else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_LONG) {
RETVAL_STRING("long", 1);
+ } else if (MBSTRG(current_filter_illegal_mode) ==
MBFL_OUTPUTFILTER_ILLEGAL_MODE_ENTITY) {
+ RETVAL_STRING("entity", 1);
} else {
RETVAL_LONG(MBSTRG(current_filter_illegal_substchar));
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php