本文整理汇总了PHP中utf8_to_unicode函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_to_unicode函数的具体用法?PHP utf8_to_unicode怎么用?PHP utf8_to_unicode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf8_to_unicode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: utf8_strpos
function utf8_strpos($haystack, $needle, $offset = 0)
{
if (!defined('UTF8_NOMBSTRING') && function_exists('mb_strpos')) {
return mb_strpos($haystack, $needle, $offset, 'utf-8');
}
$haystack = utf8_to_unicode($haystack);
$needle = utf8_to_unicode($needle);
$position = $offset;
$found = false;
while (!$found && $position < count($haystack)) {
if ($needle[0] == $haystack[$position]) {
for ($i = 1; $i < count($needle); $i++) {
if ($needle[$i] != $haystack[$position + $i]) {
break;
}
}
// for
if ($i == count($needle)) {
$found = true;
$position--;
}
// if
}
// if
$position++;
}
// while
return $found == true ? $position : false;
}
示例2: testString
function testString()
{
$unicode = array();
$unicode[0] = 73;
$unicode[1] = 241;
$unicode[2] = 116;
$unicode[3] = 235;
$unicode[4] = 114;
$unicode[5] = 110;
$unicode[6] = 226;
$unicode[7] = 116;
$unicode[8] = 105;
$unicode[9] = 244;
$unicode[10] = 110;
$unicode[11] = 224;
$unicode[12] = 108;
$unicode[13] = 105;
$unicode[14] = 122;
$unicode[15] = 230;
$unicode[16] = 116;
$unicode[17] = 105;
$unicode[18] = 248;
$unicode[19] = 110;
$this->assertEqual(utf8_to_unicode('Iñtërnâtiônàlizætiøn'), $unicode);
}
示例3: is_chinese
/**
* Check whether a string is composed with chinese chars
* @param string $str UTF8-encoded str
* @return bool TRUE for chinese str
*/
function is_chinese($str)
{
$unicode = utf8_to_unicode($str);
foreach ($unicode as $char) {
if (!detect_CJK($char)) {
return FALSE;
}
}
return TRUE;
}
示例4: utf8_keepalphanum
function utf8_keepalphanum($string)
{
global $UTF8_ALPHA_CHARS;
$chars = utf8_to_unicode($string);
for ($i = 0, $size = count($chars); $i < $size; ++$i) {
if (!in_array($chars[$i], $UTF8_ALPHA_CHARS)) {
unset($chars[$i]);
}
}
return unicode_to_utf8($chars);
}
示例5: utf8_keepalphanum
function utf8_keepalphanum($string)
{
// a-z A-Z . _ -, extended latin chars, Cyrillic and Greek
static $UTF8_ALPHA_CHARS = array(0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2e, 0x2d, 0x5f, 0x20, 0xc1, 0xe1, 0x106, 0x107, 0xc9, 0xe9, 0xcd, 0xed, 0x139, 0x13a, 0x143, 0x144, 0xd3, 0xf3, 0x154, 0x155, 0x15a, 0x15b, 0xda, 0xfa, 0xdd, 0xfd, 0x179, 0x17a, 0x10f, 0x13d, 0x13e, 0x165, 0x102, 0x103, 0x11e, 0x11f, 0x16c, 0x16d, 0x10c, 0x10d, 0x10e, 0x11a, 0x11b, 0x147, 0x148, 0x158, 0x159, 0x160, 0x161, 0x164, 0x17d, 0x17e, 0xc7, 0xe7, 0x122, 0x123, 0x136, 0x137, 0x13b, 0x13c, 0x145, 0x146, 0x156, 0x157, 0x15e, 0x15f, 0x162, 0x163, 0xc2, 0xe2, 0x108, 0x109, 0xca, 0xea, 0x11c, 0x11d, 0x124, 0x125, 0xce, 0xee, 0x134, 0x135, 0xd4, 0xf4, 0x15c, 0x15d, 0xdb, 0xfb, 0x174, 0x175, 0x176, 0x177, 0xc4, 0xe4, 0xcb, 0xeb, 0xcf, 0xef, 0xd6, 0xf6, 0xdc, 0xfc, 0x178, 0xff, 0x10a, 0x10b, 0x116, 0x117, 0x120, 0x121, 0x130, 0x131, 0x17b, 0x17c, 0x150, 0x151, 0x170, 0x171, 0xc0, 0xe0, 0xc8, 0xe8, 0xcc, 0xec, 0xd2, 0xf2, 0xd9, 0xf9, 0x1a0, 0x1a1, 0x1af, 0x1b0, 0x100, 0x101, 0x112, 0x113, 0x12a, 0x12b, 0x14c, 0x14d, 0x16a, 0x16b, 0x104, 0x105, 0x118, 0x119, 0x12e, 0x12f, 0x172, 0x173, 0xc5, 0xe5, 0x16e, 0x16f, 0x110, 0x111, 0x126, 0x127, 0x141, 0x142, 0xd8, 0xf8, 0xc3, 0xe3, 0xd1, 0xf1, 0xd5, 0xf5, 0xc6, 0xe6, 0x152, 0x153, 0xd0, 0xf0, 0xde, 0xfe, 0xdf, 0x17f, 0x391, 0x392, 0x393, 0x394, 0x395, 0x396, 0x397, 0x398, 0x399, 0x39a, 0x39b, 0x39c, 0x39d, 0x39e, 0x39f, 0x3a0, 0x3a1, 0x3a3, 0x3a4, 0x3a5, 0x3a6, 0x3a7, 0x3a8, 0x3a9, 0x386, 0x388, 0x389, 0x38a, 0x38c, 0x38e, 0x38f, 0x3aa, 0x3ab, 0x3b1, 0x3b2, 0x3b3, 0x3b4, 0x3b5, 0x3b6, 0x3b7, 0x3b8, 0x3b9, 0x3ba, 0x3bb, 0x3bc, 0x3bd, 0x3be, 0x3bf, 0x3c0, 0x3c1, 0x3c3, 0x3c2, 0x3c4, 0x3c5, 0x3c6, 0x3c7, 0x3c8, 0x3c9, 0x3ac, 0x3ad, 0x3ae, 0x3af, 0x3cc, 0x3cd, 0x3ce, 0x3ca, 0x3cb, 0x390, 0x3b0, 0x410, 0x411, 0x412, 0x413, 0x414, 0x415, 0x401, 0x416, 0x417, 0x406, 0x419, 0x41a, 0x41b, 0x41c, 0x41d, 0x41e, 0x41f, 0x420, 0x421, 0x422, 0x423, 0x40e, 0x424, 0x425, 0x426, 0x427, 0x428, 0x42b, 0x42c, 0x42d, 0x42e, 0x42f, 0x430, 0x431, 0x432, 0x433, 0x434, 0x435, 0x451, 0x436, 0x437, 0x456, 0x439, 0x43a, 0x43b, 0x43c, 0x43d, 0x43e, 0x43f, 0x440, 0x441, 0x442, 0x443, 0x45e, 0x444, 0x445, 0x446, 0x447, 0x448, 0x44b, 0x44c, 0x44d, 0x44e, 0x44f, 0x418, 0x429, 0x42a, 0x438, 0x449, 0x44a, 0x403, 0x405, 0x408, 0x409, 0x40a, 0x40c, 0x40f, 0x453, 0x455, 0x458, 0x459, 0x45a, 0x45c, 0x45f, 0x402, 0x40b, 0x452, 0x45b, 0x490, 0x404, 0x407, 0x491, 0x454, 0x457, 0x4e8, 0x4ae, 0x4e9, 0x4af);
$chars = utf8_to_unicode($string);
for ($i = 0, $size = count($chars); $i < $size; ++$i) {
if (!in_array($chars[$i], $UTF8_ALPHA_CHARS)) {
unset($chars[$i]);
}
}
return unicode_to_utf8($chars);
}
示例6: utf8_strtoupper
/**
* UTF-8 aware alternative to strtoupper
* Make a string uppercase
* Note: The concept of a characters "case" only exists is some alphabets
* such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does
* not exist in the Chinese alphabet, for example. See Unicode Standard
* Annex #21: Case Mappings
* Note: requires utf8_to_unicode and utf8_from_unicode
* @author Andreas Gohr <andi@splitbrain.org>
* @param string
* @return mixed either string in lowercase or FALSE is UTF-8 invalid
* @see http://www.php.net/strtoupper
* @see utf8_to_unicode
* @see utf8_from_unicode
* @see http://www.unicode.org/reports/tr21/tr21-5.html
* @see http://dev.splitbrain.org/view/darcs/dokuwiki/inc/utf8.php
* @package utf8
* @subpackage strings
*/
function utf8_strtoupper($string)
{
global $UTF8_LOWER_TO_UPPER;
$uni = utf8_to_unicode($string);
if (!$uni) {
return FALSE;
}
$cnt = count($uni);
for ($i = 0; $i < $cnt; $i++) {
if (isset($UTF8_LOWER_TO_UPPER[$uni[$i]])) {
$uni[$i] = $UTF8_LOWER_TO_UPPER[$uni[$i]];
}
}
return utf8_from_unicode($uni);
}
示例7: utf8_strtoupper
function utf8_strtoupper($string)
{
static $lower_to_upper;
if ($lower_to_upper == null) {
$lower_to_upper = array(0x61 => 0x41, 0x3c6 => 0x3a6, 0x163 => 0x162, 0xe5 => 0xc5, 0x62 => 0x42, 0x13a => 0x139, 0xe1 => 0xc1, 0x142 => 0x141, 0x3cd => 0x38e, 0x101 => 0x100, 0x491 => 0x490, 0x3b4 => 0x394, 0x15b => 0x15a, 0x64 => 0x44, 0x3b3 => 0x393, 0xf4 => 0xd4, 0x44a => 0x42a, 0x439 => 0x419, 0x113 => 0x112, 0x43c => 0x41c, 0x15f => 0x15e, 0x144 => 0x143, 0xee => 0xce, 0x45e => 0x40e, 0x44f => 0x42f, 0x3ba => 0x39a, 0x155 => 0x154, 0x69 => 0x49, 0x73 => 0x53, 0x1e1f => 0x1e1e, 0x135 => 0x134, 0x447 => 0x427, 0x3c0 => 0x3a0, 0x438 => 0x418, 0xf3 => 0xd3, 0x440 => 0x420, 0x454 => 0x404, 0x435 => 0x415, 0x449 => 0x429, 0x14b => 0x14a, 0x431 => 0x411, 0x459 => 0x409, 0x1e03 => 0x1e02, 0xf6 => 0xd6, 0xf9 => 0xd9, 0x6e => 0x4e, 0x451 => 0x401, 0x3c4 => 0x3a4, 0x443 => 0x423, 0x15d => 0x15c, 0x453 => 0x403, 0x3c8 => 0x3a8, 0x159 => 0x158, 0x67 => 0x47, 0xe4 => 0xc4, 0x3ac => 0x386, 0x3ae => 0x389, 0x167 => 0x166, 0x3be => 0x39e, 0x165 => 0x164, 0x117 => 0x116, 0x109 => 0x108, 0x76 => 0x56, 0xfe => 0xde, 0x157 => 0x156, 0xfa => 0xda, 0x1e61 => 0x1e60, 0x1e83 => 0x1e82, 0xe2 => 0xc2, 0x119 => 0x118, 0x146 => 0x145, 0x70 => 0x50, 0x151 => 0x150, 0x44e => 0x42e, 0x129 => 0x128, 0x3c7 => 0x3a7, 0x13e => 0x13d, 0x442 => 0x422, 0x7a => 0x5a, 0x448 => 0x428, 0x3c1 => 0x3a1, 0x1e81 => 0x1e80, 0x16d => 0x16c, 0xf5 => 0xd5, 0x75 => 0x55, 0x177 => 0x176, 0xfc => 0xdc, 0x1e57 => 0x1e56, 0x3c3 => 0x3a3, 0x43a => 0x41a, 0x6d => 0x4d, 0x16b => 0x16a, 0x171 => 0x170, 0x444 => 0x424, 0xec => 0xcc, 0x169 => 0x168, 0x3bf => 0x39f, 0x6b => 0x4b, 0xf2 => 0xd2, 0xe0 => 0xc0, 0x434 => 0x414, 0x3c9 => 0x3a9, 0x1e6b => 0x1e6a, 0xe3 => 0xc3, 0x44d => 0x42d, 0x436 => 0x416, 0x1a1 => 0x1a0, 0x10d => 0x10c, 0x11d => 0x11c, 0xf0 => 0xd0, 0x13c => 0x13b, 0x45f => 0x40f, 0x45a => 0x40a, 0xe8 => 0xc8, 0x3c5 => 0x3a5, 0x66 => 0x46, 0xfd => 0xdd, 0x63 => 0x43, 0x21b => 0x21a, 0xea => 0xca, 0x3b9 => 0x399, 0x17a => 0x179, 0xef => 0xcf, 0x1b0 => 0x1af, 0x65 => 0x45, 0x3bb => 0x39b, 0x3b8 => 0x398, 0x3bc => 0x39c, 0x45c => 0x40c, 0x43f => 0x41f, 0x44c => 0x42c, 0xfe => 0xde, 0xf0 => 0xd0, 0x1ef3 => 0x1ef2, 0x68 => 0x48, 0xeb => 0xcb, 0x111 => 0x110, 0x433 => 0x413, 0x12f => 0x12e, 0xe6 => 0xc6, 0x78 => 0x58, 0x161 => 0x160, 0x16f => 0x16e, 0x3b1 => 0x391, 0x457 => 0x407, 0x173 => 0x172, 0xff => 0x178, 0x6f => 0x4f, 0x43b => 0x41b, 0x3b5 => 0x395, 0x445 => 0x425, 0x121 => 0x120, 0x17e => 0x17d, 0x17c => 0x17b, 0x3b6 => 0x396, 0x3b2 => 0x392, 0x3ad => 0x388, 0x1e85 => 0x1e84, 0x175 => 0x174, 0x71 => 0x51, 0x437 => 0x417, 0x1e0b => 0x1e0a, 0x148 => 0x147, 0x105 => 0x104, 0x458 => 0x408, 0x14d => 0x14c, 0xed => 0xcd, 0x79 => 0x59, 0x10b => 0x10a, 0x3ce => 0x38f, 0x72 => 0x52, 0x430 => 0x410, 0x455 => 0x405, 0x452 => 0x402, 0x127 => 0x126, 0x137 => 0x136, 0x12b => 0x12a, 0x3af => 0x38a, 0x44b => 0x42b, 0x6c => 0x4c, 0x3b7 => 0x397, 0x125 => 0x124, 0x219 => 0x218, 0xfb => 0xdb, 0x11f => 0x11e, 0x43e => 0x41e, 0x1e41 => 0x1e40, 0x3bd => 0x39d, 0x107 => 0x106, 0x3cb => 0x3ab, 0x446 => 0x426, 0xfe => 0xde, 0xe7 => 0xc7, 0x3ca => 0x3aa, 0x441 => 0x421, 0x432 => 0x412, 0x10f => 0x10e, 0xf8 => 0xd8, 0x77 => 0x57, 0x11b => 0x11a, 0x74 => 0x54, 0x6a => 0x4a, 0x45b => 0x40b, 0x456 => 0x406, 0x103 => 0x102, 0x3bb => 0x39b, 0xf1 => 0xd1, 0x43d => 0x41d, 0x3cc => 0x38c, 0xe9 => 0xc9, 0xf0 => 0xd0, 0x457 => 0x407, 0x123 => 0x122);
}
$unicode = utf8_to_unicode($string);
if (!$unicode) {
return false;
}
for ($i = 0; $i < count($unicode); $i++) {
if (isset($lower_to_upper[$unicode[$i]])) {
$unicode[$i] = $lower_to_upper[$unicode[$i]];
}
}
return unicode_to_utf8($unicode);
}
示例8: utf8strtolower
/**
* utf8strtolower
*
* @param string $string
*
* @note Port of phputf8's utf8_strtolower()
*
* @return string
*/
public static function utf8strtolower($string)
{
static $UTF8_UPPER_TO_LOWER = null;
if (is_null($UTF8_UPPER_TO_LOWER)) {
$UTF8_UPPER_TO_LOWER = array(0x41 => 0x61, 0x3a6 => 0x3c6, 0x162 => 0x163, 0xc5 => 0xe5, 0x42 => 0x62, 0x139 => 0x13a, 0xc1 => 0xe1, 0x141 => 0x142, 0x38e => 0x3cd, 0x100 => 0x101, 0x490 => 0x491, 0x394 => 0x3b4, 0x15a => 0x15b, 0x44 => 0x64, 0x393 => 0x3b3, 0xd4 => 0xf4, 0x42a => 0x44a, 0x419 => 0x439, 0x112 => 0x113, 0x41c => 0x43c, 0x15e => 0x15f, 0x143 => 0x144, 0xce => 0xee, 0x40e => 0x45e, 0x42f => 0x44f, 0x39a => 0x3ba, 0x154 => 0x155, 0x49 => 0x69, 0x53 => 0x73, 0x1e1e => 0x1e1f, 0x134 => 0x135, 0x427 => 0x447, 0x3a0 => 0x3c0, 0x418 => 0x438, 0xd3 => 0xf3, 0x420 => 0x440, 0x404 => 0x454, 0x415 => 0x435, 0x429 => 0x449, 0x14a => 0x14b, 0x411 => 0x431, 0x409 => 0x459, 0x1e02 => 0x1e03, 0xd6 => 0xf6, 0xd9 => 0xf9, 0x4e => 0x6e, 0x401 => 0x451, 0x3a4 => 0x3c4, 0x423 => 0x443, 0x15c => 0x15d, 0x403 => 0x453, 0x3a8 => 0x3c8, 0x158 => 0x159, 0x47 => 0x67, 0xc4 => 0xe4, 0x386 => 0x3ac, 0x389 => 0x3ae, 0x166 => 0x167, 0x39e => 0x3be, 0x164 => 0x165, 0x116 => 0x117, 0x108 => 0x109, 0x56 => 0x76, 0xde => 0xfe, 0x156 => 0x157, 0xda => 0xfa, 0x1e60 => 0x1e61, 0x1e82 => 0x1e83, 0xc2 => 0xe2, 0x118 => 0x119, 0x145 => 0x146, 0x50 => 0x70, 0x150 => 0x151, 0x42e => 0x44e, 0x128 => 0x129, 0x3a7 => 0x3c7, 0x13d => 0x13e, 0x422 => 0x442, 0x5a => 0x7a, 0x428 => 0x448, 0x3a1 => 0x3c1, 0x1e80 => 0x1e81, 0x16c => 0x16d, 0xd5 => 0xf5, 0x55 => 0x75, 0x176 => 0x177, 0xdc => 0xfc, 0x1e56 => 0x1e57, 0x3a3 => 0x3c3, 0x41a => 0x43a, 0x4d => 0x6d, 0x16a => 0x16b, 0x170 => 0x171, 0x424 => 0x444, 0xcc => 0xec, 0x168 => 0x169, 0x39f => 0x3bf, 0x4b => 0x6b, 0xd2 => 0xf2, 0xc0 => 0xe0, 0x414 => 0x434, 0x3a9 => 0x3c9, 0x1e6a => 0x1e6b, 0xc3 => 0xe3, 0x42d => 0x44d, 0x416 => 0x436, 0x1a0 => 0x1a1, 0x10c => 0x10d, 0x11c => 0x11d, 0xd0 => 0xf0, 0x13b => 0x13c, 0x40f => 0x45f, 0x40a => 0x45a, 0xc8 => 0xe8, 0x3a5 => 0x3c5, 0x46 => 0x66, 0xdd => 0xfd, 0x43 => 0x63, 0x21a => 0x21b, 0xca => 0xea, 0x399 => 0x3b9, 0x179 => 0x17a, 0xcf => 0xef, 0x1af => 0x1b0, 0x45 => 0x65, 0x39b => 0x3bb, 0x398 => 0x3b8, 0x39c => 0x3bc, 0x40c => 0x45c, 0x41f => 0x43f, 0x42c => 0x44c, 0xde => 0xfe, 0xd0 => 0xf0, 0x1ef2 => 0x1ef3, 0x48 => 0x68, 0xcb => 0xeb, 0x110 => 0x111, 0x413 => 0x433, 0x12e => 0x12f, 0xc6 => 0xe6, 0x58 => 0x78, 0x160 => 0x161, 0x16e => 0x16f, 0x391 => 0x3b1, 0x407 => 0x457, 0x172 => 0x173, 0x178 => 0xff, 0x4f => 0x6f, 0x41b => 0x43b, 0x395 => 0x3b5, 0x425 => 0x445, 0x120 => 0x121, 0x17d => 0x17e, 0x17b => 0x17c, 0x396 => 0x3b6, 0x392 => 0x3b2, 0x388 => 0x3ad, 0x1e84 => 0x1e85, 0x174 => 0x175, 0x51 => 0x71, 0x417 => 0x437, 0x1e0a => 0x1e0b, 0x147 => 0x148, 0x104 => 0x105, 0x408 => 0x458, 0x14c => 0x14d, 0xcd => 0xed, 0x59 => 0x79, 0x10a => 0x10b, 0x38f => 0x3ce, 0x52 => 0x72, 0x410 => 0x430, 0x405 => 0x455, 0x402 => 0x452, 0x126 => 0x127, 0x136 => 0x137, 0x12a => 0x12b, 0x38a => 0x3af, 0x42b => 0x44b, 0x4c => 0x6c, 0x397 => 0x3b7, 0x124 => 0x125, 0x218 => 0x219, 0xdb => 0xfb, 0x11e => 0x11f, 0x41e => 0x43e, 0x1e40 => 0x1e41, 0x39d => 0x3bd, 0x106 => 0x107, 0x3ab => 0x3cb, 0x426 => 0x446, 0xde => 0xfe, 0xc7 => 0xe7, 0x3aa => 0x3ca, 0x421 => 0x441, 0x412 => 0x432, 0x10e => 0x10f, 0xd8 => 0xf8, 0x57 => 0x77, 0x11a => 0x11b, 0x54 => 0x74, 0x4a => 0x6a, 0x40b => 0x45b, 0x406 => 0x456, 0x102 => 0x103, 0x39b => 0x3bb, 0xd1 => 0xf1, 0x41d => 0x43d, 0x38c => 0x3cc, 0xc9 => 0xe9, 0xd0 => 0xf0, 0x407 => 0x457, 0x122 => 0x123);
}
$uni = utf8_to_unicode($string);
if (!$uni) {
return false;
}
$cnt = count($uni);
for ($i = 0; $i < $cnt; $i++) {
if (isset($UTF8_UPPER_TO_LOWER[$uni[$i]])) {
$uni[$i] = $UTF8_UPPER_TO_LOWER[$uni[$i]];
}
}
return static::fromUnicode($uni);
}
示例9: utf8_to_gbk
function utf8_to_gbk($_obfuscate_lEJkeU8)
{
global $UC2GBTABLE;
$_obfuscate_0ZRpoQQÿ = "";
if (empty($_obfuscate_M7zu18TTxzhvAÿÿ)) {
$_obfuscate_JTe7jJ4eGW8ÿ = CODETABLEDIR . "gb-unicode.table";
$_obfuscate_YBYÿ = fopen($_obfuscate_JTe7jJ4eGW8ÿ, "rb");
while ($A = fgets($_obfuscate_YBYÿ, 15)) {
$UC2GBTABLE[hexdec(substr($A, 7, 6))] = hexdec(substr($A, 0, 6));
}
fclose($_obfuscate_YBYÿ);
}
$_obfuscate_0ZRpoQQÿ = "";
$_obfuscate_7ypN_Aÿÿ = strlen($_obfuscate_lEJkeU8);
$_obfuscate_7wÿÿ = 0;
for (; $_obfuscate_7wÿÿ < $_obfuscate_7ypN_Aÿÿ; ++$_obfuscate_7wÿÿ) {
$_obfuscate_KQÿÿ = $_obfuscate_lEJkeU8[$_obfuscate_7wÿÿ];
$_obfuscate_s7Uÿ = decbin(ord($_obfuscate_lEJkeU8[$_obfuscate_7wÿÿ]));
if (strlen($_obfuscate_s7Uÿ) == 8) {
$_obfuscate_TsNQCdQÿ = strpos(decbin(ord($_obfuscate_s7Uÿ)), "0");
$_obfuscate_XAÿÿ = 0;
for (; $_obfuscate_XAÿÿ < $_obfuscate_TsNQCdQÿ; ++$_obfuscate_XAÿÿ) {
++$_obfuscate_7wÿÿ;
$_obfuscate_KQÿÿ .= $_obfuscate_lEJkeU8[$_obfuscate_7wÿÿ];
}
$_obfuscate_KQÿÿ = utf8_to_unicode($_obfuscate_KQÿÿ);
if (isset($UC2GBTABLE[$_obfuscate_KQÿÿ])) {
$_obfuscate_KQÿÿ = dechex($UC2GBTABLE[$_obfuscate_KQÿÿ] + 32896);
$_obfuscate_0ZRpoQQÿ .= chr(hexdec($_obfuscate_KQÿÿ[0] . $_obfuscate_KQÿÿ[1])) . chr(hexdec($_obfuscate_KQÿÿ[2] . $_obfuscate_KQÿÿ[3]));
} else {
$_obfuscate_0ZRpoQQÿ .= "&#" . $_obfuscate_KQÿÿ . ";";
}
} else {
$_obfuscate_0ZRpoQQÿ .= $_obfuscate_KQÿÿ;
}
}
$_obfuscate_0ZRpoQQÿ = trim($_obfuscate_0ZRpoQQÿ);
return $_obfuscate_0ZRpoQQÿ;
}
示例10: utf8_to_gbk
/**
* utf8转gbk
* @param $utfstr
*/
function utf8_to_gbk($utfstr)
{
global $UC2GBTABLE;
$okstr = '';
if (empty($UC2GBTABLE)) {
$filename = CODETABLEDIR . 'gb-unicode.table';
$fp = fopen($filename, 'rb');
while ($l = fgets($fp, 15)) {
$UC2GBTABLE[hexdec(substr($l, 7, 6))] = hexdec(substr($l, 0, 6));
}
fclose($fp);
}
$okstr = '';
$ulen = strlen($utfstr);
for ($i = 0; $i < $ulen; $i++) {
$c = $utfstr[$i];
$cb = decbin(ord($utfstr[$i]));
if (strlen($cb) == 8) {
$csize = strpos(decbin(ord($cb)), '0');
for ($j = 0; $j < $csize; $j++) {
$i++;
$c .= $utfstr[$i];
}
$c = utf8_to_unicode($c);
if (isset($UC2GBTABLE[$c])) {
$c = dechex($UC2GBTABLE[$c] + 0x8080);
$okstr .= chr(hexdec($c[0] . $c[1])) . chr(hexdec($c[2] . $c[3]));
} else {
$okstr .= '&#' . $c . ';';
}
} else {
$okstr .= $c;
}
}
$okstr = trim($okstr);
return $okstr;
}
示例11: detect_encoding
/**
* function detect_encoding($text)
* Detects the encoding of a particular text
* @return - one of GSM_7BIT, GSM_7BIT_EX, UTF16
*/
public static function detect_encoding($text, &$ex_chars)
{
if (!is_array($text)) {
$text = utf8_to_unicode($text);
}
$utf16_chars = array_diff($text, self::int_gsm_7bit_combined_map());
if (count($utf16_chars)) {
return self::UTF16;
}
$ex_chars = array_intersect($text, self::int_gsm_7bit_ex_map());
if (count($ex_chars)) {
return self::GSM_7BIT_EX;
} else {
return self::GSM_7BIT;
}
}
示例12: verbIrr
function verbIrr($stem, &$match)
{
# 각종 규칙 불규칙 처리
$ustem = utf8_to_unicode($stem);
$uend = utf8_to_unicode($match[1]);
$ch = array_pop($ustem);
$ed = $uend[0];
$save = '';
if ($this->isHangul($ch)) {
$j = hangul_to_jamo($ch);
$ej = hangul_to_jamo($ed);
$sj = sizeof($j);
if ($sj == 3 and $j[2] == 0x11bb) {
// 랐-다, 었-다, 겠-다, 였-다
if (in_array($j[1], array(0x1161, 0x1165, 0x1166, 0x1167))) {
if ($j[0] == 0x1105 and in_array($j[1], array(0x1161, 0x1165, 0x1167))) {
// 랐,렀,렸
// 갈렸-다
} else {
if (in_array($j[0], array(0x1100, 0x110b, 0x110c))) {
# 겠,았
array_unshift($uend, $ch);
unset($ch);
} else {
if ($j[1] == 0x1167 and in_array($j[0], array(0x1101, 0x1102, 0x1103, 0x1105, 0x1106, 0x1107, 0x1109, 0x110c, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112))) {
# 여 변환
// 혔 -> ㅎ+었 -> 히+었
$j[1] = 0x1165;
$syll = jamo_to_syllable(array(0x110b, $j[1], $j[2]));
array_unshift($uend, $syll[0]);
/* 혔 -> 히+었, 폈 -> 피+었 */
$j[1] = 0x1175;
$syll = jamo_to_syllable(array($j[0], $j[1]));
$ch = $syll[0];
} else {
if (in_array($j[0], array(0x1101, 0x1104, 0x110a, 0x1111, 0x1112))) {
# 우 불규칙
/* 떴 -> ㄸ + 었 */
$syll = jamo_to_syllable(array(0x110b, $j[1], $j[2]));
array_unshift($uend, $syll[0]);
/* ㄸ -> 뜨 */
$j[1] = 0x1173;
/* ㅡ */
if ($j[0] == 0x1111) {
$j[1] = 0x116e;
}
/* 펐 푸+었 */
jamo_to_syllable(array($j[0], $j[1]));
/* 쓰 */
$ch = $syll[0];
} else {
if (in_array($j[0], array(0x1101, 0x1104, 0x110a, 0x1111, 0x1112))) {
}
}
}
}
}
} else {
if ($j[0] == 0x1112 and in_array($j[1], array(0x1162))) {
array_push($ustem, 0xd558);
/* 하 */
$syll = jamo_to_syllable(array(0x110b, 0x1167, 0x11bb));
array_unshift($uend, $syll[0]);
#$match[1]='여'.$match[1]; /* 해 -> 하 + 여 */
unset($ch);
} else {
/* ㅆ를 떼어낸다. */
#print '~~'.$stem.'~~';
$syll = jamo_to_syllable(array($j[0], $j[1]));
array_unshift($uend, $j[2]);
#array_unshift($uend,hangul_jongseong_to_cjamo($j[2]));
$ch = $syll[0];
unset($j[2]);
#unset($ch);
}
}
if (!$ch) {
$ch = array_pop($ustem);
$j = hangul_to_jamo($ch);
}
$ed = $uend[0];
$ej = hangul_to_jamo($ed);
} else {
if (!empty($j[2]) and in_array($j[2], array(0x11ab, 0x11af, 0x11b8))) {
// 합-시다 갑-시다 갈-래
// 하-ㅂ시다 가-ㅂ시다 가-ㄹ래
//
if ($j[2] == 0x11af and $ej[0] == 0x1105) {
//if ($j[1] == 0x1173 and $j[2]== 0x11af and $ej[0]==0x1105) {
// 르 불규칙
// 흘-러:흐르+러
unset($j[2]);
$syll = jamo_to_syllable($j);
array_push($ustem, $syll[0]);
/* 흐 */
$j[0] = $ej[0];
$j[1] = 0x1173;
$syll = jamo_to_syllable($j);
/* 르 */
$ch = $syll[0];
//.........这里部分代码省略.........
示例13: encode
/**
* Convert an UTF-8 string to a safe ASCII String
*
* conversion process
* - if codepoint is a plain or post_indicator character,
* - if previous character was "converted", append post_indicator to output, clear "converted" flag
* - append ascii byte for character to output
* (continue to next character)
*
* - if codepoint is a pre_indicator character,
* - append ascii byte for character to output, set "converted" flag
* (continue to next character)
*
* (all remaining characters)
* - reduce codepoint value for non-printable ASCII characters (0x00 - 0x1f). Space becomes our zero.
* - convert reduced value to base36 (0-9a-z)
* - append $pre_indicator characater followed by base36 string to output, set converted flag
* (continue to next character)
*
* @param string $filename a utf8 string, should only include printable characters - not 0x00-0x1f
* @return string an encoded representation of $filename using only 'safe' ASCII characters
*
* @author Christopher Smith <chris@jalakai.co.uk>
*/
public function encode($filename)
{
return self::unicode_to_safe(utf8_to_unicode($filename));
}
示例14: gw_send_sms
function gw_send_sms($mobile_sender, $sms_to, $sms_msg, $gp_code = "", $uid = "", $smslog_id = "", $msg_type = "text", $unicode = "0")
{
global $clktl_param;
global $gateway_number;
if ($gateway_number) {
$sms_from = $gateway_number;
} else {
$sms_from = $mobile_sender;
}
switch ($msg_type) {
case "flash":
$sms_type = "SMS_FLASH";
break;
case "logo":
$sms_type = "SMS_NOKIA_OLOGO";
break;
case "picture":
$sms_type = "SMS_NOKIA_PICTURE";
break;
case "ringtone":
case "rtttl":
$sms_type = "SMS_NOKIA_RTTTL";
break;
case "text":
default:
$sms_type = "SMS_TEXT";
}
// $query_string = "sendmsg?api_id=".$clktl_param[api_id]."&user=".$clktl_param[username]."&password=".$clktl_param[password]."&to=$sms_to&msg_type=$sms_type&text=".rawurlencode($sms_msg)."&deliv_ack=1&callback=3&unicode=$unicode&concat=3&from=".rawurlencode($sms_from);
// no concat
if ($unicode) {
$sms_msg = utf8_to_unicode($sms_msg);
$query_string = "sendmsg?api_id=" . $clktl_param[api_id] . "&user=" . $clktl_param[username] . "&password=" . $clktl_param[password] . "&to={$sms_to}&msg_type={$sms_type}&text={$sms_msg}&deliv_ack=1&callback=3&unicode={$unicode}&from=" . rawurlencode($sms_from);
} else {
$query_string = "sendmsg?api_id=" . $clktl_param[api_id] . "&user=" . $clktl_param[username] . "&password=" . $clktl_param[password] . "&to={$sms_to}&msg_type={$sms_type}&text=" . rawurlencode($sms_msg) . "&deliv_ack=1&callback=3&unicode={$unicode}&from=" . rawurlencode($sms_from);
}
$url = $clktl_param[send_url] . "/" . $query_string;
$fd = file($url);
$ok = false;
$p_status = DLR_FAILED;
if ($fd) {
$response = split(":", $fd);
$err_code = trim($response[1]);
if (strtoupper($response[0]) == "ID") {
if ($apimsgid = trim($response[1])) {
clktl_setsmsapimsgid($smslog_id, $apimsgid);
list($c_sms_credit, $c_sms_status) = clktl_getsmsstatus($smslog_id);
if ($c_sms_status) {
$p_status = $c_sms_status;
} else {
$p_status = DLR_PENDING;
}
} else {
$p_status = DLR_SENT;
}
}
$ok = true;
}
setsmsdeliverystatus($smslog_id, $uid, $p_status);
return $ok;
}
示例15: utf8_to_utf16be
/**
* UTF-8 to UTF-16BE conversion.
*
* Maybe really UCS-2 without mb_string due to utf8_to_unicode limits
*/
function utf8_to_utf16be(&$str, $bom = false)
{
$out = $bom ? "��" : '';
if (!defined('UTF8_NOMBSTRING') && function_exists('mb_convert_encoding')) {
return $out . mb_convert_encoding($str, 'UTF-16BE', 'UTF-8');
}
$uni = utf8_to_unicode($str);
foreach ($uni as $cp) {
$out .= pack('n', $cp);
}
return $out;
}