#49958 [Opn->Fbk]: mb_strtoupper fails on Japanese characters

From: Date: Fri, 23 Oct 2009 10:21:01 +0000
Subject: #49958 [Opn->Fbk]: mb_strtoupper fails on Japanese characters
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-143827@lists.php.net to get a copy of this message
 ID:               49958
 Updated by:       jani@php.net
 Reported By:      mjong at magnafacta dot nl
-Status:           Open
+Status:           Feedback
 Bug Type:         mbstring related
 Operating System: Windows Vista
 PHP Version:      5.2.11
 New Comment:

mb_strtoupper() defaults to mb_internal_encoding(), so what does latter
give you? If it's not the right encoding, then there is no bug here. And
strtoupper() or ucfirst() or anything without mb_* in front of it aren't
even supposed to work with such.. :)


Previous Comments:
------------------------------------------------------------------------

[2009-10-22 16:14:01] mjong at magnafacta dot nl

Description:
------------
Using strtoupper, ms_strtoupper and derived functions like ucfirst 
produced incorrectly encoded strings when used on strings containing 
Japanese Hirigana or Katakana characters.

As no uppercase versions of these characters exists they should be 
treated as e.g. numbers.

Workaround: use mb_check_encoding to revert to the old string when this

happens.

Reproduce code:
---------------
// $s = strtoupper('まてえす and
ジョング');
$s = strtoupper(
   base64_decode('44Gm44GI44GZ').
   ' and '.
   base64_decode('44K444On44Oz44Kw'));


if (mb_check_encoding($s)) {
  echo $s;
} else {
  echo 'Error';
}


Expected result:
----------------
まてえす and
ジョング

Actual result:
--------------
Error


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=49958&edit=1



Thread (10 messages)

« previous php.bugs (#143827) next »