[PHP-dev 1091] Re: mbstringのエンコーディング名

aya aya @ big.or.jp
2005年 1月 15日 (土) 02:13:31 JST


こんにちは、綾乃介です。

Subject: [PHP-dev 1090] Re: mbstringのエンコーディング名
Date: 2005/01/15 0:27:06
Shoma Suzuki <show-ma @ yb3.so-net.ne.jp> wrote:
> しょうまです。
> 
> > HTTPヘッダやHTMLではShift_JISを使ってるのに、PHPのエンコード名に
> > Shift_JISが使えないので、文字コードを2つ定義しないといけません。
> > 何か悔しいのですが。
> > 
> > PHPのShift_JISのエンコーディング名をShift_JISでもいけるようにしませんか?
> 
> /ext/mbstring/libmbfl/filters/mbfilter_sjis.cでエイリアスが定義されてい
> ます。
> とりあえず、ですがお手元の環境でやりたいことをやりたいようにするにはの61
> 行目に任意のエンコーディング名を追加すればよいと思います。
> 
> 61:static const char *mbfl_encoding_sjis_aliases[] = {"x-sjis",
> "SHIFT-JIS", NULL};

ソースを斜め読みしてみるとSJIS-winがShift_JISに対応するかもしれないです
が。こっちに、Shift_JISのエイリアスであるMS_Kanjiが登録されています。

static const char *mbfl_encoding_sjis_win_aliases[] = {"SJIS-open", "CP932", "Windows-31J", "MS_Kanji", NULL};

Name: Shift_JIS  (preferred MIME name)
MIBenum: 17
Source: This charset is an extension of csHalfWidthKatakana by
        adding graphic characters in JIS X 0208.  The CCS's are
        JIS X0201:1997 and JIS X0208:1997.  The
        complete definition is shown in Appendix 1 of JIS
        X0208:1997.
        This charset can be used for the top-level media type "text".
Alias: MS_Kanji 
Alias: csShiftJIS

http://www.php.net/manual/ja/ref.mbstring.php

こっちは、SJISですが

http://phpspot.net/php/man/php/ref.mbstring.html

こっちでは、Shift_JISに対応してると書いてあります。
Shift_JIS=SJISの用に書いてありますが。

どうもCSVのドキュメントを見てみるとShift_JISをサポートしてる?

サポートされるエンコーディングの概要
http://cvs.php.net/co.php/phpdoc-ja/reference/mbstring/encodings.xml?r=1.1

IANA文字セット登録名: Shift_JIS (preferred MIME name) / MS_Kanji / csShift_JIS

依存する文字集合: Compound of JIS X0201:1997 / JIS X0208:1997

説明: Shift_JIS was developed in early 80's, at the time personal
Japanese word processors were brought into the market, in order to
maintain compatiblities with the legacy encoding scheme JIS X 0201:1976.
According to the IANA definition the codeset of Shift_JIS is slightly
different to IBM932 / CP932. However, the names "SJIS" / "Shift_JIS" are
often wrongly used to refer to these codesets. 

注記: For the CP932 codemap, use SJIS-WIN instead.

# ここのドキュメントはCVSから生成してるぽい
# http://nx.eth.jp/php/manual/ref.mbstring.html

調べる限りは調べてみましたが、この辺が限界です。
mbstringに詳しい方の意見をいただけないでしょうか。




PHP-dev メーリングリストの案内