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


PHP mb_list_encodings函数代码示例

本文整理汇总了PHP中mb_list_encodings函数的典型用法代码示例。如果您正苦于以下问题:PHP mb_list_encodings函数的具体用法?PHP mb_list_encodings怎么用?PHP mb_list_encodings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setInputFile

 /**
  * Sets the input xml file to be parsed
  *
  * @access  public
  * @param   string  $file  Filename(full path)
  * @return  mixed   True on success or error on failure
  */
 function setInputFile($file)
 {
     require_once PEAR_PATH . 'HTTP/Request.php';
     $httpRequest = new HTTP_Request($file, $this->_params);
     $httpRequest->setMethod(HTTP_REQUEST_METHOD_GET);
     $resRequest = $httpRequest->sendRequest();
     if (PEAR::isError($resRequest)) {
         return $resRequest;
     } elseif ($httpRequest->getResponseCode() != 200) {
         return $this->raiseError('HTTP response error', HTTP_REQUEST_ERROR_RESPONSE);
     }
     $data = trim($httpRequest->getResponseBody());
     if (version_compare(PHP_VERSION, '5.0.0', '<')) {
         if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $data, $matches)) {
             $srcenc = strtoupper($matches[1]);
             if (!in_array($srcenc, $this->_validEncodings)) {
                 if (function_exists('iconv')) {
                     $data = @iconv($srcenc, 'UTF-8', $data);
                 } elseif (function_exists('mb_list_encodings') && in_array($srcenc, array_map('strtoupper', mb_list_encodings()))) {
                     $data = @mb_convert_encoding($data, 'UTF-8', $srcenc);
                 }
             }
         }
     }
     $this->setInputString($data);
     return true;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:34,代码来源:XML_Feed.php

示例2: __construct

 function __construct()
 {
     $this->name = strtolower(get_class($this));
     $this->text_domain = $this->name;
     $this->skip_next_call = false;
     $this->charset = get_bloginfo('charset');
     $this->load_options();
     // Carefully support multibyte languages
     if (extension_loaded('mbstring') && function_exists('mb_list_encodings')) {
         $this->mb = in_array($this->charset, mb_list_encodings());
     }
     //load_plugin_textdomain($this->text_domain, PLUGINDIR . '/advanced-excerpt/');
     // __FILE__ doesn't seem to work
     /*
     $file = ABSPATH . PLUGINDIR . '/advanced-excerpt/advanced-excerpt.php';
     register_activation_hook($file, array(
       &$this,
       'install'
     ));
     */
     if (!get_option($this->name . '_length')) {
         $this->install();
         // WPCOM only add options if options don't exists
     }
     //register_deactivation_hook($file, array(&$this, 'uninstall'));
     add_action('admin_menu', array(&$this, 'add_pages'));
     // Replace the default filter (see /wp-includes/default-filters.php)
     remove_filter('get_the_excerpt', 'wp_trim_excerpt');
     add_filter('get_the_excerpt', array(&$this, 'filter'));
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:30,代码来源:advanced-excerpt.php

示例3: url_slug

/**
 * Create a web friendly URL slug from a string.
 * 
 * Although supported, transliteration is discouraged because
 *     1) most web browsers support UTF-8 characters in URLs
 *     2) transliteration causes a loss of information
 *
 * @author Sean Murphy <sean@iamseanmurphy.com>
 * @copyright Copyright 2012 Sean Murphy. All rights reserved.
 * @license http://creativecommons.org/publicdomain/zero/1.0/
 *
 * @param string $str
 * @param array $options
 * @return string
 */
function url_slug($str, $options = array())
{
    // Make sure string is in UTF-8 and strip invalid UTF-8 characters
    $str = html_entity_decode($str, ENT_COMPAT, 'UTF-8');
    $str = mb_convert_encoding((string) $str, 'UTF-8', mb_list_encodings());
    $str = preg_replace("/&#\\d+;/i", '', $str);
    //удаление не преобразованных элементов
    $defaults = array('delimiter' => '-', 'limit' => null, 'lowercase' => true, 'replacements' => array(), 'transliterate' => false);
    // Merge options
    $options = array_merge($defaults, $options);
    $char_map = array('À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'Æ' => 'AE', 'Ç' => 'C', 'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ð' => 'D', 'Ñ' => 'N', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', 'Ő' => 'O', 'Ø' => 'O', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ű' => 'U', 'Ý' => 'Y', 'Þ' => 'TH', 'ß' => 'ss', 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'æ' => 'ae', 'ç' => 'c', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ð' => 'd', 'ñ' => 'n', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ő' => 'o', 'ø' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', 'ű' => 'u', 'ý' => 'y', 'þ' => 'th', 'ÿ' => 'y', '©' => '(c)', 'Α' => 'A', 'Β' => 'B', 'Γ' => 'G', 'Δ' => 'D', 'Ε' => 'E', 'Ζ' => 'Z', 'Η' => 'H', 'Θ' => '8', 'Ι' => 'I', 'Κ' => 'K', 'Λ' => 'L', 'Μ' => 'M', 'Ν' => 'N', 'Ξ' => '3', 'Ο' => 'O', 'Π' => 'P', 'Ρ' => 'R', 'Σ' => 'S', 'Τ' => 'T', 'Υ' => 'Y', 'Φ' => 'F', 'Χ' => 'X', 'Ψ' => 'PS', 'Ω' => 'W', 'Ά' => 'A', 'Έ' => 'E', 'Ί' => 'I', 'Ό' => 'O', 'Ύ' => 'Y', 'Ή' => 'H', 'Ώ' => 'W', 'Ϊ' => 'I', 'Ϋ' => 'Y', 'α' => 'a', 'β' => 'b', 'γ' => 'g', 'δ' => 'd', 'ε' => 'e', 'ζ' => 'z', 'η' => 'h', 'θ' => '8', 'ι' => 'i', 'κ' => 'k', 'λ' => 'l', 'μ' => 'm', 'ν' => 'n', 'ξ' => '3', 'ο' => 'o', 'π' => 'p', 'ρ' => 'r', 'σ' => 's', 'τ' => 't', 'υ' => 'y', 'φ' => 'f', 'χ' => 'x', 'ψ' => 'ps', 'ω' => 'w', 'ά' => 'a', 'έ' => 'e', 'ί' => 'i', 'ό' => 'o', 'ύ' => 'y', 'ή' => 'h', 'ώ' => 'w', 'ς' => 's', 'ϊ' => 'i', 'ΰ' => 'y', 'ϋ' => 'y', 'ΐ' => 'i', 'Ş' => 'S', 'İ' => 'I', 'Ç' => 'C', 'Ü' => 'U', 'Ö' => 'O', 'Ğ' => 'G', 'ş' => 's', 'ı' => 'i', 'ç' => 'c', 'ü' => 'u', 'ö' => 'o', 'ğ' => 'g', 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', 'Д' => 'D', 'Е' => 'E', 'Ё' => 'Yo', 'Ж' => 'Zh', 'З' => 'Z', 'И' => 'I', 'Й' => 'J', 'К' => 'K', 'Л' => 'L', 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'Ch', 'Ш' => 'Sh', 'Щ' => 'Sh', 'Ъ' => '', 'Ы' => 'Y', 'Ь' => '', 'Э' => 'E', 'Ю' => 'Yu', 'Я' => 'Ya', 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'yo', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sh', 'ъ' => '', 'ы' => 'y', 'ь' => '', 'э' => 'e', 'ю' => 'yu', 'я' => 'ya', 'Є' => 'Ye', 'І' => 'I', 'Ї' => 'Yi', 'Ґ' => 'G', 'є' => 'ye', 'і' => 'i', 'ї' => 'yi', 'ґ' => 'g', 'Č' => 'C', 'Ď' => 'D', 'Ě' => 'E', 'Ň' => 'N', 'Ř' => 'R', 'Š' => 'S', 'Ť' => 'T', 'Ů' => 'U', 'Ž' => 'Z', 'č' => 'c', 'ď' => 'd', 'ě' => 'e', 'ň' => 'n', 'ř' => 'r', 'š' => 's', 'ť' => 't', 'ů' => 'u', 'ž' => 'z', 'Ą' => 'A', 'Ć' => 'C', 'Ę' => 'e', 'Ł' => 'L', 'Ń' => 'N', 'Ó' => 'o', 'Ś' => 'S', 'Ź' => 'Z', 'Ż' => 'Z', 'ą' => 'a', 'ć' => 'c', 'ę' => 'e', 'ł' => 'l', 'ń' => 'n', 'ó' => 'o', 'ś' => 's', 'ź' => 'z', 'ż' => 'z', 'Ā' => 'A', 'Č' => 'C', 'Ē' => 'E', 'Ģ' => 'G', 'Ī' => 'i', 'Ķ' => 'k', 'Ļ' => 'L', 'Ņ' => 'N', 'Š' => 'S', 'Ū' => 'u', 'Ž' => 'Z', 'ā' => 'a', 'č' => 'c', 'ē' => 'e', 'ģ' => 'g', 'ī' => 'i', 'ķ' => 'k', 'ļ' => 'l', 'ņ' => 'n', 'š' => 's', 'ū' => 'u', 'ž' => 'z');
    // Make custom replacements
    $str = preg_replace(array_keys($options['replacements']), $options['replacements'], $str);
    // Transliterate characters to ASCII
    if ($options['transliterate']) {
        $str = str_replace(array_keys($char_map), $char_map, $str);
    }
    // Replace non-alphanumeric characters with our delimiter
    $str = preg_replace('/[^\\p{L}\\p{Nd}]+/u', $options['delimiter'], $str);
    // Remove duplicate delimiters
    $str = preg_replace('/(' . preg_quote($options['delimiter'], '/') . '){2,}/', '$1', $str);
    // Truncate slug to max. characters
    $str = mb_substr($str, 0, $options['limit'] ? $options['limit'] : mb_strlen($str, 'UTF-8'), 'UTF-8');
    // Remove delimiter from ends
    $str = trim($str, $options['delimiter']);
    return $options['lowercase'] ? mb_strtolower($str, 'UTF-8') : $str;
}
开发者ID:skybee,项目名称:france,代码行数:42,代码来源:url_name2_helper.php

示例4: setup

 /**
  * Setup callback
  *
  * @param AppModel $model
  * @param array $config
  */
 function setup(&$model, $config = array())
 {
     if (true === empty($config)) {
         $config = array();
     }
     // Merge user settings with default
     $settings = am($this->defaultSettings, $config);
     foreach ($settings as $mode) {
         if (true === $mode['useMbstring'] && false !== $mode['convertTo']) {
             if (false === function_exists('mb_convert_encoding')) {
                 trigger_error('Sorry, your PHP version does not support mbstring functions. Please read notes at http://php.net/mbstring', E_USER_ERROR);
             }
             // Check if we have a list of all valid encodings supported by PHP
             if (true === empty($this->validEncodings)) {
                 // Build the list of valid encodings
                 $this->validEncodings = mb_list_encodings();
             }
             // Check if we have valid encodings in our list
             if (false === array_search($mode['convertTo'], $this->validEncodings)) {
                 trigger_error('Invalid target encoding for "' . $model->name . '::find" - ' . $mode['convertTo'] . ' is not valid!', E_USER_ERROR);
             }
         }
     }
     $this->settings[$model->name] = $settings;
 }
开发者ID:paulToro,项目名称:webrocket,代码行数:31,代码来源:utf8_behavior.php

示例5: __toString

 public function __toString()
 {
     $string = $this->text_to_transform;
     // Make sure string is in UTF-8 and strip invalid UTF-8 characters
     $string = mb_convert_encoding((string) $string, 'UTF-8', mb_list_encodings());
     // Make custom replacements
     $string = preg_replace(array_keys($this->replacements), $this->replacements, $string);
     // Transliterate characters to ASCII
     if ($this->transliterate) {
         $string = str_replace(array_keys($this->charMap), $this->charMap, $string);
     }
     // Replace non-alphanumeric characters with our delimiter
     $string = preg_replace('/[^\\p{L}\\p{Nd}]+/u', $this->delimiter, $string);
     // Remove duplicate delimiters
     $string = preg_replace('/(' . preg_quote($this->delimiter, '/') . '){2,}/', '$1', $string);
     // Truncate slug to max. characters
     if ($this->limit) {
         $string = mb_substr($string, 0, $this->limit, 'UTF-8');
     }
     // Remove delimiter from ends
     $string = trim($string, $this->delimiter);
     // lowercase
     if ($this->lowercase) {
         $string = mb_strtolower($string, 'UTF-8');
     }
     return $string;
 }
开发者ID:alaindessi,项目名称:adweb,代码行数:27,代码来源:Slugifier.php

示例6: slugify

 public static function slugify($string, $delimiter = '-', $transliterate = False, $hexaAccentClean = False, $lowercase = True, $limit = NULL, $replacements = array())
 {
     // Make sure string is in UTF-8 and strip invalid UTF-8 characters
     $string = mb_convert_encoding((string) $string, 'UTF-8', mb_list_encodings());
     // Make custom replacements
     $string = preg_replace(array_keys($replacements), $replacements, $string);
     // Transliterate characters to ASCII
     if ($transliterate) {
         $string = str_replace(array_keys(self::$charMap), self::$charMap, $string);
     }
     // Replace non-alphanumeric characters with our delimiter
     $string = preg_replace('/[^\\p{L}\\p{Nd}]+/u', $delimiter, $string);
     if ($hexaAccentClean) {
         $string = self::hexaAccentCleaning($string);
     }
     // Remove duplicate delimiters
     $string = preg_replace('/(' . preg_quote($delimiter, '/') . '){2,}/', '$1', $string);
     // Truncate slug to max. characters
     if ($limit) {
         $string = mb_substr($string, 0, $limit, 'UTF-8');
     }
     // Remove delimiter from ends
     $string = trim($string, $delimiter);
     return $lowercase ? mb_strtolower($string, 'UTF-8') : $string;
 }
开发者ID:emirhg,项目名称:slug.php,代码行数:25,代码来源:Slugifier.php

示例7: url

 /**
  * Make url from a string
  *
  * @param string $str
  * @param array $options
  * @return string
  */
 function url($str = '', $options = array())
 {
     /**
      * Make sure string is in UTF-8 and strip invalid UTF-8 characters
      */
     if (!function_exists('mb_list_encodings')) {
         $list_encodings = $this->mb_list_encodings_m();
     } else {
         $list_encodings = mb_list_encodings();
     }
     $str = mb_convert_encoding((string) $str, 'UTF-8', $list_encodings);
     $defaults = array('delimiter' => '-', 'limit' => null, 'lowercase' => true, 'replacements' => array(), 'transliterate' => true);
     // Merge options
     $options = array_merge($defaults, $options);
     // Make custom replacements
     $str = preg_replace(array_keys($options['replacements']), $options['replacements'], $str);
     //replace char nokia to utf-8
     $str = $this->NokiaFixer($str);
     // Transliterate characters to ASCII
     if ($options['transliterate']) {
         $str = $this->translate2en($str);
     }
     // Replace non-alphanumeric characters with our delimiter
     $str = preg_replace('/[^\\p{L}\\p{Nd}]+/u', $options['delimiter'], $str);
     // Remove duplicate delimiters
     $str = preg_replace('/(' . preg_quote($options['delimiter'], '/') . '){2,}/', '$1', $str);
     // Truncate slug to max. characters
     $str = mb_substr($str, 0, $options['limit'] ? $options['limit'] : mb_strlen($str, 'UTF-8'), 'UTF-8');
     // Remove delimiter from ends
     $str = trim($str, $options['delimiter']);
     return $options['lowercase'] ? mb_strtolower($str, 'UTF-8') : $str;
 }
开发者ID:kimtung,项目名称:a,代码行数:39,代码来源:seo.lib.php

示例8: convert

 /**
  * Return converted Response'body
  *
  * @param string       $body
  * @param string|array $metadata 'content-type'
  * $param $remains
  *
  * @return mixed
  */
 public final function convert($body, $metadata = array(), $remains = null)
 {
     if (is_string($metadata)) {
         $ctype = $metadata;
     } elseif (is_array($metadata)) {
         $ctype = isset($metadata['content-type']) ? $metadata['content-type'] : null;
     } else {
         $ctype = null;
     }
     $body = $this->_initBody($body);
     $encoding_from = $this->_encodingFrom($body, $ctype);
     // if not avilable for mbstring, using iconv
     if (!in_array($encoding_from, mb_list_encodings())) {
         $body = @iconv($encoding_from, 'UTF-8', $body);
         if (isset($remains)) {
             foreach ($remains as $k => $v) {
                 $remains[$k] = @iconv($encoding_from, 'UTF-8', $v);
             }
             return array($body, $remains);
         }
         return $body;
     }
     if (isset($remains)) {
         @mb_convert_variables('UTF-8', $encoding_from, $body, $remains);
         return array($body, $remains);
     } else {
         $body = mb_convert_encoding($body, 'UTF-8', $encoding_from);
         return $body;
     }
 }
开发者ID:bobbyshaw,项目名称:Diggin_Http_Charset,代码行数:39,代码来源:AbstractConverter.php

示例9: utf8

 function utf8()
 {
     $this->charsets = array("ASMO-708" => "Arabic", "BIG5" => "Chinese Traditional", "CP1026" => "IBM EBCDIC (Turkish Latin-5)", "cp866" => "Cyrillic (DOS)", "CP870" => "IBM EBCDIC (Multilingual Latin-2)", "CISO2022JP" => "Japanese (JIS-Allow 1 byte Kana)", "DOS-720" => "Arabic (DOS)", "DOS-862" => "Hebrew (DOS)", "EBCDIC-CP-US" => "IBM EBCDIC (US-Canada)", "EUC-CN" => "Chinese Simplified (EUC)", "EUC-JP" => "Japanese (EUC)", "EUC-KR" => "Korean (EUC)", "GB2312" => "Chinese Simplified (GB2312)", "HZ-GB-2312" => "Chinese Simplified (HZ)", "IBM437" => "OEM United States", "IBM737" => "Greek (DOS)", "IBM775" => "Baltic (DOS)", "IBM850" => "Western European (DOS)", "IBM852" => "Central European (DOS)", "IBM857" => "Turkish (DOS)", "IBM861" => "Icelandic (DOS)", "IBM869" => "Greek, Modern (DOS)", "ISO-2022-JP" => "Japanese (JIS)", "ISO-2022-JP" => "Japanese (JIS-Allow 1 byte Kana - SO/SI)", "ISO-2022-KR" => "Korean (ISO)", "ISO-8859-1" => "Western European (ISO)", "ISO-8859-15" => "Latin 9 (ISO)", "ISO-8859-2" => "Central European (ISO)", "ISO-8859-3" => "Latin 3 (ISO)", "ISO-8859-4" => "Baltic (ISO)", "ISO-8859-5" => "Cyrillic (ISO)", "ISO-8859-6" => "Arabic (ISO)", "ISO-8859-7" => "Greek (ISO)", "ISO-8859-8" => "Hebrew (ISO-Visual)", "ISO-8859-8-i" => "Hebrew (ISO-Logical)", "ISO-8859-9" => "Turkish (ISO)", "JOHAB" => "Korean (Johab)", "KOi8-R" => "Cyrillic (KOI8-R)", "KOi8-U" => "Cyrillic (KOI8-U)", "KS_C_5601-1987" => "Korean", "MACINTOSH" => "Western European (MAC)", "SHIFT_JIS" => "Japanese (Shift-JIS)", "UNICODE" => "Unicode", "UNICODEFFFE" => "Unicode (Big-Endian)", "US-ASCII" => "US-ASCII", "UTF-7" => "Unicode (UTF-7)", "UTF-8" => "Unicode (UTF-8)", "WINDOWS-1250" => "Central European (Windows)", "WINDOWS-1251" => "Cyrillic (Windows)", "WINDOWS-1252" => "Western European (Windows)", "WINDOWS-1253" => "Greek (Windows)", "WINDOWS-1254" => "Turkish (Windows)", "WINDOWS-1255" => "Hebrew (Windows)", "WINDOWS-1256" => "Arabic (Windows)", "WINDOWS-1257" => "Baltic (Windows)", "WINDOWS-1258" => "Vietnamese (Windows)", "WINDOWS-874" => "Thai (Windows)");
     // prune the list to supported character sets
     $this->iconv_sets = array();
     $this->mb_sets = array();
     if (function_exists('mb_convert_encoding')) {
         if (function_exists('mb_list_encodings')) {
             $list = mb_list_encodings();
         } else {
             $list = array("pass", "auto", "byte2be", "byte2le", "byte4be", "byte4le", "BASE64", "UUENCODE", "HTML-ENTITIES", "Quoted-Printable", "7bit", "8bit", "UCS-4", "UCS-4BE", "UCS-4LE", "UCS-2", "UCS-2BE", "UCS-2LE", "UTF-32", "UTF-32BE", "UTF-32LE", "UTF-16", "UTF-16BE", "UTF-16LE", "UTF-8", "UTF-7", "UTF7-IMAP", "ASCII", "EUC-JP", "SJIS", "eucJP-win", "SJIS-win", "CP51932", "JIS", "ISO-2022-JP", "ISO-2022-JP-MS", "Windows-1252", "ISO-8859-1", "ISO-8859-2", "ISO-8859-3", "ISO-8859-4", "ISO-8859-5", "ISO-8859-6", "ISO-8859-7", "ISO-8859-8", "ISO-8859-9", "ISO-8859-10", "ISO-8859-13", "ISO-8859-14", "ISO-8859-15", "ISO-8859-16", "EUC-CN", "CP936", "HZ", "EUC-TW", "BIG-5", "EUC-KR", "UHC", "ISO-2022-KR", "Windows-1251", "CP866", "KOI8-R", "ArmSCII-8");
         }
         foreach ($this->charsets as $key => $encoding) {
             if (in_array($key, $list)) {
                 $this->mb_sets[$key] = $encoding;
             }
         }
     }
     if (function_exists('iconv')) {
         foreach ($this->charsets as $key => $encoding) {
             if (@iconv("UTF-8", $key, "UTF-8") !== false) {
                 $this->iconv_sets[$key] = $encoding;
             }
         }
     }
     $this->validsets = array_merge($this->mb_sets, $this->iconv_sets);
 }
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:27,代码来源:lib-utf8.php

示例10: setEncoding

 /**
  * Sets the chunker's character encoding
  *
  * @param  string|null  $encoding  the chunker's character encoding
  * @throws  InvalidArgumentException  if $encoding is not an supported charset;
  *     the special string 'auto'; or, null
  * @since  0.1.0
  */
 public function setEncoding($encoding)
 {
     if (!is_string($encoding) || !in_array($encoding, mb_list_encodings())) {
         throw new \InvalidArgumentException(__METHOD__ . "() expects parameter one, encoding, to be a valid " . "character encoding name");
     }
     $this->encoding = $encoding;
     return $this;
 }
开发者ID:jstewmc,项目名称:chunker,代码行数:16,代码来源:Chunker.php

示例11: getEncodingsAry

 /**
  * get all built-in encodings as array
  * @return array $ary
  */
 public static function getEncodingsAry()
 {
     static $ary = null;
     if (!$ary) {
         $ary = mb_list_encodings();
     }
     return $ary;
 }
开发者ID:diversen,项目名称:simple-php-classes,代码行数:12,代码来源:mb.php

示例12: __construct

 /**
  * Constructor
  * 
  */
 public function __construct($init_array = NULL)
 {
     // build the valid encodings once for mime decoding
     // could cache this even further up the chain
     $this->valid_mb_encoding_array = array_flip(array_change_key_case(array_flip(mb_list_encodings())));
     // call the parent constructor
     parent::__construct($init_array);
 }
开发者ID:salbordonaro,项目名称:peeker,代码行数:12,代码来源:peeker.php

示例13: get_jis_name

 function get_jis_name()
 {
     if (function_exists('mb_list_encodings')) {
         $list = "\t" . implode("\t", mb_list_encodings()) . "\t";
         return preg_match("/\tISO-2022-JP-MS\t/i", $list) ? 'ISO-2022-JP-MS' : 'ISO-2022-JP';
     } else {
         return 'ISO-2022-JP';
     }
 }
开发者ID:Trd-vandolph,项目名称:olivecode-chapter-24,代码行数:9,代码来源:class.php

示例14: __construct

 /**
  * Initializes the class with the given parameters.
  *
  * The constructor accepts the following options:
  *
  * - `encoding` (string, default=string "UTF-8") Encoding to use
  *
  * @param array $params RequestBlock configuration options
  * @param Content $contentBlock ContentBlock of request
  * @throws InvalidArgumentException
  */
 public function __construct(array $params, Content $contentBlock)
 {
     $defaults = ['encoding' => 'UTF-8'];
     $config = array_merge($defaults, $params);
     if (!in_array($config['encoding'], mb_list_encodings())) {
         throw new InvalidArgumentException('Requested encoding is not supported');
     }
     $this->controlBlock = new ControlBlock($config);
     $this->operationBlock = new OperationBlock($config, $contentBlock);
 }
开发者ID:Intacct,项目名称:intacct-sdk-php,代码行数:21,代码来源:RequestBlock.php

示例15: getEncoding

 static private function getEncoding($string, $encoding) {
     if (!ArrayHelper::in_arrayi($encoding, \mb_list_encodings())) {
         if (strpos(strtolower($encoding), strtolower('Windows-125')) !== false) {
             $encoding = 'Windows-1252';
         } else {
             $encoding = \mb_detect_encoding($string);
         }
     }
     return $encoding;
 }
开发者ID:nathan-gs,项目名称:Calliope,代码行数:10,代码来源:CharacterEncodingHelper.php


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