From 3bc01b5d0b88dbf8e7f56848004a197229aec2dc Mon Sep 17 00:00:00 2001 From: Moriyoshi Koizumi Date: Wed, 23 Oct 2002 20:32:51 +0000 Subject: Modified mb_convert_case() to handle cased characters properly when MB_CASE_TITLE is specified. --- ext/mbstring/php_unicode.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'ext/mbstring/php_unicode.c') diff --git a/ext/mbstring/php_unicode.c b/ext/mbstring/php_unicode.c index f095d314bc..f62adeaffe 100644 --- a/ext/mbstring/php_unicode.c +++ b/ext/mbstring/php_unicode.c @@ -257,11 +257,26 @@ PHPAPI char *php_unicode_convert_case(int case_mode, char *srcstr, size_t srclen } break; - case PHP_UNICODE_CASE_TITLE: + case PHP_UNICODE_CASE_TITLE: { + int mode = 0; + for (i = 0; i < unicode_len / sizeof(unsigned long); i++) { - unicode_ptr[i] = php_unicode_totitle(unicode_ptr[i]); + int res = php_unicode_is_prop(unicode_ptr[i], + UC_MN|UC_ME|UC_CF|UC_LM|UC_SK|UC_LU|UC_LL|UC_LT, 0); + if (mode) { + if (res) { + unicode_ptr[i] = php_unicode_tolower(unicode_ptr[i]); + } else { + mode = 0; + } + } else { + if (res) { + mode = 1; + unicode_ptr[i] = php_unicode_totitle(unicode_ptr[i]); + } + } } - break; + } break; } -- cgit v1.2.1