| [ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 require_once DOKU_INC.'inc/utf8.php'; 4 5 // use no mbstring help here 6 if(!defined('UTF8_NOMBSTRING')) define('UTF8_NOMBSTRING',1); 7 8 class utf8_unicode_test extends UnitTestCase { 9 10 function test_from_1byte(){ 11 $in = 'a'; 12 $out = array(97); 13 $this->assertEqual(utf8_to_unicode($in),$out); 14 } 15 16 function test_from_2byte(){ 17 $in = "\xc3\xbc"; 18 $out = array(252); 19 $this->assertEqual(utf8_to_unicode($in),$out); 20 } 21 22 function test_from_3byte(){ 23 $in = "\xe2\x99\x8a"; 24 $out = array(9802); 25 $this->assertEqual(utf8_to_unicode($in),$out); 26 } 27 28 function test_from_4byte(){ 29 $in = "\xf4\x80\x80\x81"; 30 $out = array(1048577); 31 $this->assertEqual(utf8_to_unicode($in),$out); 32 } 33 34 function test_to_1byte(){ 35 $out = 'a'; 36 $in = array(97); 37 $this->assertEqual(unicode_to_utf8($in),$out); 38 } 39 40 function test_to_2byte(){ 41 $out = "\xc3\xbc"; 42 $in = array(252); 43 $this->assertEqual(unicode_to_utf8($in),$out); 44 } 45 46 function test_to_3byte(){ 47 $out = "\xe2\x99\x8a"; 48 $in = array(9802); 49 $this->assertEqual(unicode_to_utf8($in),$out); 50 } 51 52 function test_to_4byte(){ 53 $out = "\xf4\x80\x80\x81"; 54 $in = array(1048577); 55 $this->assertEqual(unicode_to_utf8($in),$out); 56 } 57 58 } 59 60 //Setup VIM: ex: et ts=4 enc=utf-8 :
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Dec 3 01:30:02 2008 | Cross-referenced by PHPXref 0.7 |