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


PHP SystemTextEncoding::isUtf8方法代码示例

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


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

示例1: toStorageEncoding

 /**
  * Decode a string from UTF8 to current Storage Charset
  * @static
  * @param string $filesystemElement
  * @param bool $test Try to detect if it's really utf8 or not
  * @return string
  */
 public static function toStorageEncoding($filesystemElement, $test = false)
 {
     if ($test && !SystemTextEncoding::isUtf8($filesystemElement)) {
         return $filesystemElement;
     }
     $enc = SystemTextEncoding::getEncoding();
     return SystemTextEncoding::changeCharset("UTF-8", $enc, $filesystemElement);
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:15,代码来源:class.SystemTextEncoding.php

示例2: mimeExtractorCallback

 public function mimeExtractorCallback($masterFile, $targetFile)
 {
     $metadata = array();
     require_once "Mail/mimeDecode.php";
     $params = array('include_bodies' => true, 'decode_bodies' => false, 'decode_headers' => 'UTF-8');
     $mess = ConfService::getMessages();
     $content = file_get_contents($masterFile);
     $decoder = new Mail_mimeDecode($content);
     $structure = $decoder->decode($params);
     $allowedHeaders = array("to", "from", "subject", "message-id", "mime-version", "date", "return-path");
     foreach ($structure->headers as $hKey => $hValue) {
         if (!in_array($hKey, $allowedHeaders)) {
             continue;
         }
         if (is_array($hValue)) {
             $hValue = implode(", ", $hValue);
         }
         if ($hKey == "date") {
             $date = strtotime($hValue);
             $metadata["eml_time"] = $date;
         }
         $metadata["eml_" . $hKey] = AJXP_Utils::xmlEntities(@htmlentities($hValue, ENT_COMPAT, "UTF-8"));
         //$this->logDebug($hKey." - ".$hValue. " - ".$metadata["eml_".$hKey]);
         if ($metadata["eml_" . $hKey] == "") {
             $metadata["eml_" . $hKey] = AJXP_Utils::xmlEntities(@htmlentities($hValue));
             if (!SystemTextEncoding::isUtf8($metadata["eml_" . $hKey])) {
                 $metadata["eml_" . $hKey] = SystemTextEncoding::toUTF8($metadata["eml_" . $hKey]);
             }
         }
         $metadata["eml_" . $hKey] = str_replace("&", "&", $metadata["eml_" . $hKey]);
     }
     $metadata["eml_attachments"] = 0;
     $parts = $structure->parts;
     if (!empty($parts)) {
         foreach ($parts as $mimePart) {
             if (!empty($mimePart->disposition) && $mimePart->disposition == "attachment") {
                 $metadata["eml_attachments"]++;
             }
         }
     }
     $metadata["icon"] = "eml_images/ICON_SIZE/mail_mime.png";
     file_put_contents($targetFile, serialize($metadata));
 }
开发者ID:biggtfish,项目名称:cms,代码行数:43,代码来源:class.EmlParser.php

示例3: toUTF8

 /**
  * Transform a string from current charset to utf8
  * @static
  * @param string $filesystemElement
  * @param bool $test Test if it's already UTF8 or not, to avoid double-encoding
  * @return string
  */
 static function toUTF8($filesystemElement, $test = true)
 {
     if ($test && SystemTextEncoding::isUtf8($filesystemElement)) {
         return $filesystemElement;
     }
     $enc = SystemTextEncoding::getEncoding();
     return SystemTextEncoding::changeCharset($enc, "UTF-8", $filesystemElement);
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:15,代码来源:class.SystemTextEncoding.php


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