1--TEST-- 2mb_preferred_mime_name() 3--SKIPIF-- 4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> 5--FILE-- 6<?php 7// TODO: Add more encoding names 8 9//$debug=true; 10ini_set('include_path', dirname(__FILE__)); 11include_once('common.inc'); 12 13 14$str = mb_preferred_mime_name('sjis-win'); 15echo "$str\n"; 16 17$str = mb_preferred_mime_name('SJIS'); 18echo "$str\n"; 19 20$str = mb_preferred_mime_name('EUC-JP'); 21echo "$str\n"; 22 23$str = mb_preferred_mime_name('UTF-8'); 24echo "$str\n"; 25 26$str = mb_preferred_mime_name('ISO-2022-JP'); 27echo "$str\n"; 28 29$str = mb_preferred_mime_name('JIS'); 30echo "$str\n"; 31 32$str = mb_preferred_mime_name('ISO-8859-1'); 33echo "$str\n"; 34 35$str = mb_preferred_mime_name('UCS2'); 36echo "$str\n"; 37 38$str = mb_preferred_mime_name('UCS4'); 39echo "$str\n"; 40 41echo "== INVALID PARAMETER ==\n"; 42// Invalid name 43$r = mb_preferred_mime_name('BAD_NAME'); 44($r === FALSE) ? print("OK_BAD_NAME\n") : print("NG_BAD_NAME\n"); 45 46?> 47 48--EXPECT-- 49Shift_JIS 50Shift_JIS 51EUC-JP 52UTF-8 53ISO-2022-JP 54ISO-2022-JP 55ISO-8859-1 56UCS-2 57UCS-4 58== INVALID PARAMETER == 59ERR: Warning 60OK_BAD_NAME 61 62