根据 libiconv-1.14/lib/encodings.def , UTF-8和UTF8都会被识别成utf8编码,所以没有区别,所以所有使用libiconv的程序都没问题,比如php的iconv库。/* General multi-byte encodings */
DEFENCODING(( "UTF-8", /* IANA, RFC 2279 */
/*"UTF8", JDK 1.1 */
/*"CP65001", Windows */
),
utf8,
{ utf8_mbtowc, NULL }, { utf8_wctomb, NULL })
#ifdef USE_HPUX_ALIASES
DEFALIAS( "UTF8", /* HP-UX */
utf8)
#endif
根据 ext/mbstring 的 mbfilter_utf8.c ,UTF-8 (作为name/mimename) 和 UTF8 (作为alias)也都可以被识别,所以也一样。static const char *mbfl_encoding_utf8_aliases[] = {"utf8", NULL};
const mbfl_encoding mbfl_encoding_utf8 = {
mbfl_no_encoding_utf8,
"UTF-8",
"UTF-8",
(const char *(*)[])&mbfl_encoding_utf8_aliases,
mblen_table_utf8,
MBFL_ENCTYPE_MBCS
};
顺便说一下,mysql不识别 utf-8,必须用utf8。mysql> create table t1 (id int primary key, name int) character set utf-8;
ERROR 1115 (42000): Unknown character set: 'utf'