Mercurial > hg > extraction-interface
diff develop/config/Lib_mb_utf8.php @ 6:63e08b98032f
rewrite extraction interface into PHP MVC architecture.
(Although js hasn't been rewritten into MVC, it's fitted into the current PHP MVC architecture.)
- The root of the new PHP MVC is at 'develop/'.
- extraction interface is called "Extractapp" with several action, eg TaggingText, EditWordlist, EditTaglist, ExportTable.
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 05 Feb 2015 16:07:53 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/develop/config/Lib_mb_utf8.php Thu Feb 05 16:07:53 2015 +0100 @@ -0,0 +1,76 @@ +<?php + mb_regex_encoding('UTF-8'); + mb_internal_encoding('UTF-8'); + + // ****************************************************************************** + + function mb($s) { + return mb8($s); + } + + function mb16($s) { + //return mb_convert_encoding($s, 'UTF-16LE'); + return big5_to_utf16($s); + } + + function mb8($s) { + //return mb_convert_encoding($s, 'UTF-16LE'); + return big5_to_utf8($s); + } + + function u8b5($s) { + return utf8_to_big5($s); + } + + function b5u8($s) { + return big5_to_utf8($s); + } + + function u8u16($s) { + return utf8_to_utf16($s); + } + + function u16u8($s) { + return utf16_to_utf8($s); + } + + function b5u16($s) { + return big5_to_utf16($s); + } + + function u16b5($s) { + return utf16_to_big5($s); + } + + function big5_to_utf16($s) { + if (!$s) return ''; + return iconv("BIG-5", "UTF-16LE", $s); + } + + function utf16_to_big5($s) { + if (!$s) return ''; + return iconv("UTF-16LE", "BIG-5//IGNORE", $s); + } + + function utf16_to_utf8($s) { + if (!$s) return ''; + return iconv("UTF-16LE", "UTF-8", $s); + } + + function utf8_to_utf16($s) { + if (!$s) return ''; + return iconv("UTF-8", "UTF-16LE", $s); + } + + function big5_to_utf8($s) { + if (!$s) return ''; + return iconv("CP950", "UTF-8//IGNORE", $s); + } + + function utf8_to_big5($s) { + if (!$s) return ''; + return iconv("UTF-8", "CP950//IGNORE", $s); + } + + // ****************************************************************************** +?>