1--TEST-- 2mb_internal_encoding() 3--SKIPIF-- 4<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> 5--FILE-- 6<?php 7// TODO: 8//$debug = true; 9ini_set('include_path', dirname(__FILE__)); 10include_once('common.inc'); 11 12// EUC-JP 13$r = mb_internal_encoding('EUC-JP'); 14($r === TRUE) ? print "OK_EUC-JP_SET\n" : print "NG_EUC-JP_SET\n"; 15$enc = mb_internal_encoding(); 16print "$enc\n"; 17 18// UTF-8 19$r = mb_internal_encoding('UTF-8'); 20($r === TRUE) ? print "OK_UTF-8_SET\n" : print "NG_UTF-8_SET\n"; 21$enc = mb_internal_encoding(); 22print "$enc\n"; 23 24// ASCII 25$r = mb_internal_encoding('ASCII'); 26($r === TRUE) ? print "OK_ASCII_SET\n" : print "NG_ASCII_SET\n"; 27$enc = mb_internal_encoding(); 28print "$enc\n"; 29 30// Invalid Parameter 31print "== INVALID PARAMETER ==\n"; 32 33// Note: Other than string type, PHP raises Warning 34$r = mb_internal_encoding('BAD'); 35($r === FALSE) ? print "OK_BAD_SET\n" : print "NG_BAD_SET\n"; 36$enc = mb_internal_encoding(); 37print "$enc\n"; 38 39$r = mb_internal_encoding($t_ary); 40($r === FALSE) ? print "OK_BAD_ARY_SET\n" : print "NG_BAD_ARY_SET\n"; 41$enc = mb_internal_encoding(); 42print "$enc\n"; 43 44$r = mb_internal_encoding($t_obj); 45($r === FALSE) ? print "OK_BAD_OBJ_SET\n" : print "NG_BAD_OBJ_SET\n"; 46$enc = mb_internal_encoding(); 47print "$enc\n"; 48 49?> 50 51--EXPECT-- 52OK_EUC-JP_SET 53EUC-JP 54OK_UTF-8_SET 55UTF-8 56OK_ASCII_SET 57ASCII 58== INVALID PARAMETER == 59ERR: Warning 60OK_BAD_SET 61ASCII 62ERR: Warning 63OK_BAD_ARY_SET 64ASCII 65ERR: Warning 66OK_BAD_OBJ_SET 67ASCII 68 69