- $agresive_decoding = false;
-
- if (ereg('iso-8859-([[:digit:]]+)', $charset, $res)) {
- if ($res[1] == '1') {
- include_once(SM_PATH . 'functions/decode/iso8859-1.php');
- $ret = charset_decode_iso8859_1 ($string);
- } else if ($res[1] == '2') {
- include_once(SM_PATH . 'functions/decode/iso8859-2.php');
- $ret = charset_decode_iso8859_2 ($string);
- } else if ($res[1] == '3') {
- include_once(SM_PATH . 'functions/decode/iso8859-3.php');
- $ret = charset_decode_iso8859_3 ($string);
- } else if ($res[1] == '4') {
- include_once(SM_PATH . 'functions/decode/iso8859-4.php');
- $ret = charset_decode_iso8859_4 ($string);
- } else if ($res[1] == '5') {
- include_once(SM_PATH . 'functions/decode/iso8859-5.php');
- $ret = charset_decode_iso8859_5 ($string);
- } else if ($res[1] == '6') {
- include_once(SM_PATH . 'functions/decode/iso8859-6.php');
- $ret = charset_decode_iso8859_6 ($string);
- } else if ($res[1] == '7') {
- include_once(SM_PATH . 'functions/decode/iso8859-7.php');
- $ret = charset_decode_iso8859_7 ($string);
- } else if ($res[1] == '8') {
- include_once(SM_PATH . 'functions/decode/iso8859-8.php');
- $ret = charset_decode_iso8859_8 ($string);
- } else if ($res[1] == '9') {
- include_once(SM_PATH . 'functions/decode/iso8859-9.php');
- $ret = charset_decode_iso8859_9 ($string);
- } else if ($res[1] == '10') {
- include_once(SM_PATH . 'functions/decode/iso8859-10.php');
- $ret = charset_decode_iso8859_10 ($string);
- } else if ($res[1] == '11') {
- include_once(SM_PATH . 'functions/decode/iso8859-11.php');
- $ret = charset_decode_iso8859_11 ($string);
- } else if ($res[1] == '13') {
- include_once(SM_PATH . 'functions/decode/iso8859-13.php');
- $ret = charset_decode_iso8859_13 ($string);
- } else if ($res[1] == '14') {
- include_once(SM_PATH . 'functions/decode/iso8859-14.php');
- $ret = charset_decode_iso8859_14 ($string);
- } else if ($res[1] == '15') {
- include_once(SM_PATH . 'functions/decode/iso8859-15.php');
- $ret = charset_decode_iso8859_15 ($string);
- } else if ($res[1] == '16') {
- include_once(SM_PATH . 'functions/decode/iso8859-16.php');
- $ret = charset_decode_iso8859_16 ($string);
- } else {
- $ret = charset_decode_iso_8859_default ($string);
- }
- } else if ($charset == 'ns_4551-1') {
- $ret = charset_decode_ns_4551_1 ($string);
- } else if ($charset == 'koi8-r') {
- include_once(SM_PATH . 'functions/decode/koi8-r.php');
- $ret = charset_decode_koi8r ($string);
- } else if ($charset == 'koi8-u') {
- include_once(SM_PATH . 'functions/decode/koi8-u.php');
- $ret = charset_decode_koi8u ($string);
- } else if ($charset == 'windows-1250') {
- include_once(SM_PATH . 'functions/decode/cp1250.php');
- $ret = charset_decode_cp1250 ($string);
- } else if ($charset == 'windows-1251') {
- include_once(SM_PATH . 'functions/decode/cp1251.php');
- $ret = charset_decode_cp1251 ($string);
- } else if ($charset == 'windows-1252') {
- include_once(SM_PATH . 'functions/decode/cp1252.php');
- $ret = charset_decode_cp1252 ($string);
- } else if ($charset == 'windows-1253') {
- include_once(SM_PATH . 'functions/decode/cp1253.php');
- $ret = charset_decode_cp1253 ($string);
- } else if ($charset == 'windows-1254') {
- include_once(SM_PATH . 'functions/decode/cp1254.php');
- $ret = charset_decode_cp1254 ($string);
- } else if ($charset == 'windows-1255') {
- include_once(SM_PATH . 'functions/decode/cp1255.php');
- $ret = charset_decode_cp1255 ($string);
- } else if ($charset == 'windows-1256') {
- include_once(SM_PATH . 'functions/decode/cp1256.php');
- $ret = charset_decode_cp1256 ($string);
- } else if ($charset == 'windows-1257') {
- include_once(SM_PATH . 'functions/decode/cp1257.php');
- $ret = charset_decode_cp1257 ($string);
- } else if ($charset == 'windows-1258') {
- include_once(SM_PATH . 'functions/decode/cp1258.php');
- $ret = charset_decode_cp1258 ($string);
- } else if ($charset == 'big5' and $agresive_decoding ) {
- include_once(SM_PATH . 'functions/decode/big5.php');
- $ret = charset_decode_big5 ($string);
- } else if ($charset == 'gb2312' and $agresive_decoding ) {
- include_once(SM_PATH . 'functions/decode/gb2312.php');
- $ret = charset_decode_gb2312 ($string);
- } else if ($charset == 'utf-8') {
- include_once(SM_PATH . 'functions/decode/utf-8.php');
- $ret = charset_decode_utf8 ($string);