Zend_Validate_Alnumがなんかおかしい – 適当にメモったらこうなった

Zend_Validate_Alnumがなんかおかしい – 適当にメモったらこうなった

UTF-8環境下では挙動がおかしくなるという話で。
Zend_Validate_Alnum中のパターンを

[php]
$pattern = ‘/[^\p{Ll}\p{Lu}\p{N}' . $whiteSpace . ']/u’;
[/php]

に変更するとUTF-8でもマッチング可能になります。
マルチバイトは何かと気をつけないといけませんね。

関連する記事:

Powered by

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">