當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。