| PicoWorkshop |
|
|
|
| PHP |
| PHP5の文字セットをUTF-8に変更する。 |
サーバーの文字コードをUTF-8を標準とするためにPHP環境をUTF-8に変更します。
インストール直後のPHP scriptをはEUC-JPがディフォルトです。
これをUTF-8に変更します。
文字変換にはmbstringという拡張モジュールを使います。
output_handler = mb_output_handler
; ; PHP's built-in default is text/html default_mimetype = "text/html"
;default_charset = "iso-8859-1"
default_charset = "UTF-8"
; Always populate the $HTTP_RAW_POST_DATA variable. ;always_populate_raw_post_data
= On
|
mbstringの設定は以下のように設定します。
この設定を行う事でスクリプトの文字セットや、PHPスクリプト実行後に出力されるHTMLもUTF-8で出力されるようになります。
[mbstring]
; language for internal character representation.
;mbstring.language = Japanese
mbstring.language = Japanese
; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
;mbstring.internal_encoding = EUC-JP
mbstring.internal_encoding = UTF-8
; http input encoding.
;mbstring.http_input = auto
mbstring.http_input = auto
; http output encoding. mb_output_handler must be
; registered as output buffer to function
;mbstring.http_output = SJIS
mbstring.http_output = UTF-8
; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
; portable libs/applications.
;mbstring.encoding_translation = Off
mbstring.encoding_translation = On
; automatic encoding detection order.
; auto means
;mbstring.detect_order = auto
mbstring.detect_order = auto
; substitute_character used when character cannot be converted
; one from another
;mbstring.substitute_character = none;
mbstring.substitute_character = auto;
|
 |
|
 |
|
|
|