diff options
author | Moriyoshi Koizumi <moriyoshi@php.net> | 2002-10-23 20:32:51 +0000 |
---|---|---|
committer | Moriyoshi Koizumi <moriyoshi@php.net> | 2002-10-23 20:32:51 +0000 |
commit | 3bc01b5d0b88dbf8e7f56848004a197229aec2dc (patch) | |
tree | 67fe83cab8059fdde9b5650da9fd8add91120bb9 /ext/mbstring/php_unicode.c | |
parent | 4a9f1a93962c40acc442ccf297fe6b0c2197035e (diff) | |
download | php-git-3bc01b5d0b88dbf8e7f56848004a197229aec2dc.tar.gz |
Modified mb_convert_case() to handle cased characters properly when MB_CASE_TITLE is specified.
Diffstat (limited to 'ext/mbstring/php_unicode.c')
-rw-r--r-- | ext/mbstring/php_unicode.c | 21 |
1 files changed, 18 insertions, 3 deletions
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; } |