当前位置: 首页>>代码示例>>PHP>>正文


PHP Utf8::utf8_encode方法代码示例

本文整理汇总了PHP中Patchwork\Utf8::utf8_encode方法的典型用法代码示例。如果您正苦于以下问题:PHP Utf8::utf8_encode方法的具体用法?PHP Utf8::utf8_encode怎么用?PHP Utf8::utf8_encode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Patchwork\Utf8的用法示例。


在下文中一共展示了Utf8::utf8_encode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: composeReader

 protected function composeReader($o)
 {
     if (is_file($this->realpath) && false !== ($a = file_get_contents($this->realpath))) {
         $a && false !== strpos($a, "\r") && ($a = strtr(str_replace("\r\n", "\n", $a), "\r", "\n"));
         u::isUtf8($a) || ($a = u::utf8_encode($a));
         $o->code = pStudio_highlighter::highlight($a, $this->language, true);
     }
     return $o;
 }
开发者ID:nicolas-grekas,项目名称:Patchwork-pStudio,代码行数:9,代码来源:php.php

示例2: composeReader

 protected function composeReader($o)
 {
     if (is_file($this->realpath) && false !== ($a = file_get_contents($this->realpath))) {
         $b = @unserialize($a);
         if (false !== $b || $a === serialize(false)) {
             $a = '<?php serialize(' . var_export($b, true) . ')';
             u::isUtf8($a) || ($a = u::utf8_encode($a));
             $o->text = $a;
         }
     }
     return $o;
 }
开发者ID:nicolas-grekas,项目名称:Patchwork-pStudio,代码行数:12,代码来源:ser.php

示例3: composeReader

 protected function composeReader($o)
 {
     if (is_file($this->realpath) && false !== ($a = file_get_contents($this->realpath))) {
         if (preg_match('/[\\x00-\\x08\\x0B\\x0E-\\x1A\\x1C-\\x1F]/', substr($a, 0, 512))) {
             $o->is_binary = true;
         } else {
             $a && false !== strpos($a, "\r") && ($a = strtr(str_replace("\r\n", "\n", $a), "\r", "\n"));
             u::isUtf8($a) || ($a = u::utf8_encode($a));
             $o->text = $a;
         }
     }
     return $o;
 }
开发者ID:nicolas-grekas,项目名称:Patchwork-pStudio,代码行数:13,代码来源:opener.php

示例4: api_utf8_encode

/**
 * Converts a given string into UTF-8 encoded string.
 * @param string $string                    The string being converted.
 * @param string $from_encoding (optional)    The encoding that $string is being converted from. If it is omited, the platform character set is assumed.
 * @return string                            Returns the converted string.
 * This function is aimed at replacing the function utf8_encode() for human-language strings.
 * @link http://php.net/manual/en/function.utf8-encode
 */
function api_utf8_encode($string, $from_encoding = null)
{
    return u::utf8_encode($string);
}
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:12,代码来源:internationalization.lib.php

示例5: filterString

 static function filterString($s, $normalization_form = 4, $leading_combining = '◌')
 {
     if (false !== strpos($s, "\r")) {
         // Workaround https://bugs.php.net/65732
         $s = str_replace("\r\n", "\n", $s);
         $s = strtr($s, "\r", "\n");
     }
     if (preg_match('/[\\x80-\\xFF]/', $s)) {
         if (n::isNormalized($s, $normalization_form)) {
             $n = '';
         } else {
             $n = n::normalize($s, $normalization_form);
             if (false === $n) {
                 $s = u::utf8_encode($s);
             } else {
                 $s = $n;
             }
         }
         if ($s[0] >= "�" && false !== $n && isset($leading_combining[0]) && preg_match('/^\\p{Mn}/u', $s)) {
             // Prevent leading combining chars
             // for NFC-safe concatenations.
             $s = $leading_combining . $s;
         }
     }
     return $s;
 }
开发者ID:pyjac,项目名称:BSSB,代码行数:26,代码来源:Bootup.php


注:本文中的Patchwork\Utf8::utf8_encode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。