「日本語で9文字以上のユーザー名でユーザー登録すると文字化けする。」と問い合わせがあったので少しHackしてみました。
これは、Joomla!1.0.xの場合です。
これには2つの原因があります。データベースの文字数制限と、ユーザー登録時の文字数制限です。
まず、phpMyAdminでデータベースを開きます。
次にRoot/includes/joomla.phpを開き以下の行を変更します。(2826行目付近)
// check that username is not greater than 25 characters
$username = $this->username;
if ( strlen($username) > 25 ) {
$this->username = substr( $username, 0, 25 );
}
の25の部分をデータベースと同様に51に変更します。
// check that username is not greater than 25 characters
$username = $this->username;
if ( strlen($username) > 51 ) {
$this->username = substr( $username, 0, 51 );
}
以上で日本語17文字のユーザー名まで登録できるようになりました。
今回は、51としましたがお好みで3の倍数になるように変更されても良いのではないでしょうか。
クライアントから苦情がっ!Joomla!のデフォルトの検索窓から日本語を7文字以上いれて検索すると文字化けすると言われ、確認すると確かに文字化けしますね。ちょっとJoomla!のファイルを変更してみました。
フロントエンド/components/com_search/search.brush:brush:php;;の77~~87行目あたり。
// limit searchword to 20 characters
if ( strlen( $searchword ) > 20 ) {
$searchword = substr( $searchword, 0, 19 );
$restriction = 1;
}
// searchword must contain a minimum of 3 characters
if ( $searchword && strlen( $searchword ) < 3 ) {
$searchword = '';
$restriction = 1;
}
を
// limit searchword to 20 characters
if ( mb_strlen( $searchword ) > 20 ) {
$searchword = mb_substr( $searchword, 0, 19 );
$restriction = 1;
}
// searchword must contain a minimum of 3 characters
if ( $searchword && mb_strlen( $searchword ) < 3 ) {
$searchword = '';
$restriction = 1;
}
に変更しました。