FAQ(よくある質問とその回答)
Home

Q

PHP(+MySQL or PostgreSQL)の出力が部分的に文字化けします。

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

A

画面にEUC-JPの文字とEUCの文字が混在しており、metaタグで shift_jisと指定されているためEUCの文字が文字化けしている状態ですのでどちらかの文字コードに統一する必要がございます。

PHPファイルを配置されているディレクトリに下記の SJIS 用の .htaccessファイルを配置いただき、PHPの出力設定を SJIS に変更してください。

[.htaccessの内容]
SJIS用
php_flag output_buffering On
php_value output_handler mb_output_handler
php_value default_charset Shift_JIS
php_value mbstring.language Japanese
php_flag mbstring.encoding_translation On
php_value mbstring.http_input auto
php_value mbstring.http_output SJIS
php_value mbstring.internal_encoding EUC-JP
php_value mbstring.substitute_character none


EUC-JP用
php_flag output_buffering Off
php_value default_charset EUC-JP
php_value mbstring.language Japanese
php_flag mbstring.encoding_translation On
php_value mbstring.http_input auto
php_value mbstring.http_output EUC-JP
php_value mbstring.internal_encoding EUC-JP
php_value mbstring.substitute_character none


※1 PHPの各設定は .htaccess により変更が可能です。


FAQトップへ戻る