'mb_detect_encoding'에 해당되는 글 1건

  1. 2008/03/06 mb_detect_encoding 함수

http://www.php.net/manual/en/function.mb-detect-encoding.php


데이터의 캐릭터셋을 판단하는 아주 유용한 함수이다.

string mb_detect_encoding ( string $str [, mixed $encoding_list [, bool $strict ]] )

mb_detect_encoding() detects character encoding in string str . It returns detected character encoding.

encoding_list is list of character encoding. Encoding order may be specified by array or comma separated list string.

If encoding_list is omitted, detect_order is used.

strict specifies whether to use the strict encoding detection or not. Default is FALSE.



Example#1 mb_detect_encoding() example

<?php
/* Detect character encoding with current detect_order */
echo mb_detect_encoding($str);

/* "auto" is expanded to "ASCII,JIS,UTF-8,EUC-JP,SJIS" */
echo mb_detect_encoding($str, "auto");

/* Specify encoding_list character encoding by comma separated list */
echo mb_detect_encoding($str, "JIS, eucjp-win, sjis-win");

/* Use array to specify encoding_list  */
$ary[] = "ASCII";
$ary[] = "JIS";
$ary[] = "EUC-JP";
echo
mb_detect_encoding($str, $ary);
?>


UTF-8 에 대한 좋은 문서들 링크

http://wyb330.egloos.com/3535249

http://sizuha.egloos.com/2563282

http://kldp.org/node/91358

http://blog.wystan.net/2007/08/18/bom-byte-order-mark-problem

http://b.mytears.org/2005/01/101

http://b.mytears.org/2005/03/136