本文整理汇总了PHP中ARC2::toUTF8方法的典型用法代码示例。如果您正苦于以下问题:PHP ARC2::toUTF8方法的具体用法?PHP ARC2::toUTF8怎么用?PHP ARC2::toUTF8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ARC2
的用法示例。
在下文中一共展示了ARC2::toUTF8方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testToUTF8
public function testToUTF8()
{
$actual = ARC2::toUTF8('foo');
$this->assertEquals('foo', $actual);
$actual = ARC2::toUTF8(utf8_encode('Iñtërnâtiônàlizætiøn'));
$this->assertEquals('Iñtërnâtiônàlizætiøn', $actual);
}
示例2: getUTF8Char
function getUTF8Char($v)
{
$val = $v[1];
if (strlen(trim($val)) === 1) {
return utf8_encode($val);
}
if (preg_match('/^([\\x00-\\x7f])(.+)/', $val, $m)) {
return $m[1] . ARC2::toUTF8($m[2]);
}
return $val;
}
示例3: xString
function xString($v)
{
/* largely simplified, may need some tweaks in following revisions */
$sub_v = $v;
if (!preg_match('/^\\s*([\']{3}|\'|[\\"]{3}|\\")(.*)$/s', $sub_v, $m)) {
return array(0, $v);
}
$delim = $m[1];
$rest = $m[2];
$sub_types = array("'''" => 'literal_long1', '"""' => 'literal_long2', "'" => 'literal1', '"' => 'literal2');
$sub_type = $sub_types[$delim];
if (preg_match('/^([^\\x5c]*|.*[^\\x5c]|.*\\x5c{2})' . str_replace("'", "\\'", $delim) . '(.*)$/sU', $rest, $m)) {
return array(array('value' => ARC2::toUTF8($m[1]), 'type' => 'literal', 'sub_type' => $sub_type), $m[2]);
}
return array(0, $v);
}
示例4: toUTF8
function toUTF8($str)
{
return $this->adjust_utf8 ? ARC2::toUTF8($str) : $str;
}
示例5: toUTF8
function toUTF8($v)
{
return $this->adjust_utf8 ? ARC2::toUTF8($v) : $v;
}
示例6: getOComp
function getOComp($val)
{
/* try date (e.g. 21 August 2007) */
if (preg_match('/^[0-9]{1,2}\\s+[a-z]+\\s+[0-9]{4}/i', $val) && ($uts = strtotime($val)) && $uts !== -1) {
return date("Y-m-d\\TH:i:s", $uts);
}
if (preg_match('/^[0-9]{4}[0-9\\-\\:\\T\\Z\\+]+([a-z]{2,3})?$/i', $val)) {
return $val;
}
if (is_numeric($val)) {
$val = sprintf("%f", $val);
if (preg_match("/([\\-\\+])([0-9]*)\\.([0-9]*)/", $val, $m)) {
return $m[1] . sprintf("%018s", $m[2]) . "." . sprintf("%-015s", $m[3]);
}
if (preg_match("/([0-9]*)\\.([0-9]*)/", $val, $m)) {
return "+" . sprintf("%018s", $m[1]) . "." . sprintf("%-015s", $m[2]);
}
return $val;
}
/* any other string: remove tags, linebreaks etc. */
$val = substr(trim(preg_replace('/[\\W\\s]+/is', '-', strip_tags($val))), 0, 35);
return ARC2::toUTF8($val);
}