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


PHP iconv_get_encoding函数代码示例

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


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

示例1: getEncoding

 public function getEncoding(string $type = 'input') : string
 {
     if (!in_array($type, $this->inputs)) {
         throw new InvalidArgumentException('Error', 'invalidInput', $type);
     }
     return iconv_get_encoding($type . '_encoding');
 }
开发者ID:znframework,项目名称:znframework,代码行数:7,代码来源:InternalIV.php

示例2: getEncoding

 public function getEncoding($type = 'input')
 {
     if (!is_string($type) || empty($type)) {
         return Error::set(lang('Error', 'stringParameter', '1.(type)'));
     }
     return iconv_get_encoding($type . '_encoding');
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:7,代码来源:IV.php

示例3: _purifyValue

 protected function _purifyValue($val)
 {
     if ($val == $this->_example) {
         $val = null;
     } else {
         static $purifier = null;
         if ($this->_prevent_xss) {
             if (!empty($val)) {
                 if ($purifier == null && class_exists('HTMLPurifier')) {
                     if (iconv_get_encoding("internal_encoding") != "UTF-8") {
                         $config = HTMLPurifier_Config::createDefault();
                         $config->set('Core.Encoding', iconv_get_encoding("internal_encoding"));
                         // replace with your encoding
                         $purifier = new HTMLPurifier($config);
                     } else {
                         $purifier = new HTMLPurifier();
                     }
                 }
                 if ($purifier != null) {
                     $val = $purifier->purify($val);
                 }
             }
         }
     }
     return $val;
 }
开发者ID:laiello,项目名称:lion-framework,代码行数:26,代码来源:InputComponent.class.php

示例4: getOutputEncoding

 /**
  * @return string
  */
 public static function getOutputEncoding()
 {
     if (self::versionGreaterOrEquals56()) {
         return ini_get('output_encoding');
     }
     return iconv_get_encoding('output_encoding');
 }
开发者ID:emagister,项目名称:zendframework1,代码行数:10,代码来源:EncodingProxy.php

示例5: getInternalEncoding

 /**
  * Gets the current internal encoding.
  *
  * @return string The encoding "name".
  * @throws EncodingDetectionException If the detection fails.
  */
 public static function getInternalEncoding()
 {
     $encoding = iconv_get_encoding(static::ICONV_INTERNAL_ENCODING_FLAG);
     if (false === $encoding) {
         throw EncodingDetectionException::forCurrentSystem();
     }
     return $encoding;
 }
开发者ID:robinpowered,项目名称:php-ntlm,代码行数:14,代码来源:IconvEncodingConverter.php

示例6: mb_internal_encoding

 function mb_internal_encoding($enc = FALSE)
 {
     if (function_exists('iconv_set_encoding')) {
         if ($enc) {
             iconv_set_encoding('internal_encoding', $enc);
         }
         return iconv_get_encoding('internal_encoding');
     }
     return '';
 }
开发者ID:chaobj001,项目名称:tt,代码行数:10,代码来源:func_mbstring.php

示例7: setEncoding

 public function setEncoding($encoding = null)
 {
     if ($encoding !== null) {
         $orig = iconv_get_encoding('internal_encoding');
         $result = iconv_set_encoding('internal_encoding', $encoding);
         if (!$result) {
             require_once 'Zend/Validate/Exception.php';
             throw new Zend_Validate_Exception('Given encoding not supported on this OS!');
         }
         iconv_set_encoding('internal_encoding', $orig);
     }
     $this->_encoding = $encoding;
     return $this;
 }
开发者ID:hackingman,项目名称:TubeX,代码行数:14,代码来源:StringLength.php

示例8: initIconv

 /**
  * init iconv
  */
 protected static function initIconv()
 {
     if (extension_loaded('iconv')) {
         if ('UTF-8' !== strtoupper(iconv_get_encoding('input_encoding'))) {
             iconv_set_encoding('input_encoding', 'UTF-8');
         }
         if ('UTF-8' !== strtoupper(iconv_get_encoding('internal_encoding'))) {
             iconv_set_encoding('internal_encoding', 'UTF-8');
         }
         if ('UTF-8' !== strtoupper(iconv_get_encoding('output_encoding'))) {
             iconv_set_encoding('output_encoding', 'UTF-8');
         }
     } elseif (!defined('ICONV_IMPL')) {
         require __DIR__ . '/bootup/iconv.php';
     }
 }
开发者ID:hhgr,项目名称:hhgolf,代码行数:19,代码来源:Bootup.php

示例9: initIconv

 public static function initIconv()
 {
     if (extension_loaded('iconv')) {
         if ('UTF-8' !== strtoupper(iconv_get_encoding('input_encoding'))) {
             iconv_set_encoding('input_encoding', 'UTF-8');
         }
         if ('UTF-8' !== strtoupper(iconv_get_encoding('internal_encoding'))) {
             iconv_set_encoding('internal_encoding', 'UTF-8');
         }
         if ('UTF-8' !== strtoupper(iconv_get_encoding('output_encoding'))) {
             iconv_set_encoding('output_encoding', 'UTF-8');
         }
     } elseif (!function_exists('iconv')) {
         require __DIR__ . '/Bootup/iconv.php';
     }
 }
开发者ID:roberto-sanchez,项目名称:gardencentral,代码行数:16,代码来源:Bootup.php

示例10: loadResources

 public function loadResources($language_iso_code, __ActionIdentity $action_identity = null)
 {
     $language_file = $this->getLanguageFile($language_iso_code, $action_identity);
     $return_value = array();
     if (is_file($language_file) && is_readable($language_file)) {
         $resources = parse_ini_file($language_file, false);
         foreach ($resources as $key => $value) {
             if ($this->_encoding != null) {
                 $value = iconv($this->_encoding, iconv_get_encoding("internal_encoding"), $value);
             }
             $resource = $this->_createResource($key, $value);
             $return_value[$key] = $resource;
             unset($resource);
         }
     }
     return $return_value;
 }
开发者ID:laiello,项目名称:lion-framework,代码行数:17,代码来源:IniFileResourceProvider.class.php

示例11: setEncoding

 public function setEncoding($encoding = null)
 {
     if ($encoding !== null) {
         $orig = iconv_get_encoding('internal_encoding');
         if (PHP_VERSION_ID < 50600) {
             $result = iconv_set_encoding('internal_encoding', $encoding);
         } else {
             $result = ini_set('default_charset', $encoding);
         }
         if (!$result) {
             throw new Exception('Given encoding not supported on this OS!');
         }
         if (PHP_VERSION_ID < 50600) {
             iconv_set_encoding('internal_encoding', $orig);
         } else {
             ini_set('default_charset', $orig);
         }
     }
     $this->_encoding = $encoding;
     return $this;
 }
开发者ID:brgomes,项目名称:life-framework,代码行数:21,代码来源:StringLength.php

示例12: initIconv

 static function initIconv()
 {
     if (extension_loaded('iconv')) {
         if ('UTF-8' !== iconv_get_encoding('input_encoding')) {
             iconv_set_encoding('input_encoding', 'UTF-8');
             ini_set('iconv.input_encoding', 'UTF-8');
         }
         if ('UTF-8' !== iconv_get_encoding('internal_encoding')) {
             iconv_set_encoding('internal_encoding', 'UTF-8');
             ini_set('iconv.internal_encoding', 'UTF-8');
         }
         if ('UTF-8' !== iconv_get_encoding('output_encoding')) {
             iconv_set_encoding('output_encoding', 'UTF-8');
             ini_set('iconv.output_encoding', 'UTF-8');
         }
     } else {
         if (!defined('ICONV_IMPL')) {
             require __DIR__ . '/Bootup/iconv.php';
         }
     }
 }
开发者ID:pyjac,项目名称:BSSB,代码行数:21,代码来源:Bootup.php

示例13: setEncoding

 /**
  * Sets a new encoding to use
  *
  * @param string $encoding
  * @return \Zend\Validator\StringLength
  */
 public function setEncoding($encoding = null)
 {
     if ($encoding !== null) {
         $orig = iconv_get_encoding('internal_encoding');
         $result = iconv_set_encoding('internal_encoding', $encoding);
         if (!$result) {
             throw new Exception\InvalidArgumentException('Given encoding not supported on this OS!');
         }
         iconv_set_encoding('internal_encoding', $orig);
     }
     $this->_encoding = $encoding;
     return $this;
 }
开发者ID:alab1001101,项目名称:zf2,代码行数:19,代码来源:StringLength.php

示例14: _api_iconv_set_encoding

/**
 * Sets specified internal encoding configuration variables within the PHP iconv extension.
 * @param string $type					The parameter $type could be: 'iconv_internal_encoding', 'iconv_input_encoding', or 'iconv_output_encoding'.
 * @param string $encoding (optional)	The desired encoding to be set.
 * @return bool							Returns TRUE on success, FALSE on error.
 * Note: This function is used in the global initialization script for setting these three internal encodings to the platform's character set.
 * @link http://php.net/manual/en/function.iconv-set-encoding
 */
function _api_iconv_set_encoding($type, $encoding = null)
{
    static $iconv_internal_encoding = null;
    static $iconv_input_encoding = null;
    static $iconv_output_encoding = null;
    if (!ICONV_INSTALLED) {
        return false;
    }
    switch ($type) {
        case 'iconv_internal_encoding':
            if (empty($encoding)) {
                if (is_null($iconv_internal_encoding)) {
                    $iconv_internal_encoding = @iconv_get_encoding($type);
                }
                return $iconv_internal_encoding;
            }
            if (_api_iconv_supports($encoding)) {
                if (@iconv_set_encoding($type, $encoding)) {
                    $iconv_internal_encoding = $encoding;
                    return true;
                }
                return false;
            }
            return false;
        case 'iconv_input_encoding':
            if (empty($encoding)) {
                if (is_null($iconv_input_encoding)) {
                    $iconv_input_encoding = @iconv_get_encoding($type);
                }
                return $iconv_input_encoding;
            }
            if (_api_iconv_supports($encoding)) {
                if (@iconv_set_encoding($type, $encoding)) {
                    $iconv_input_encoding = $encoding;
                    return true;
                }
                return false;
            }
            return false;
        case 'iconv_output_encoding':
            if (empty($encoding)) {
                if (is_null($iconv_output_encoding)) {
                    $iconv_output_encoding = @iconv_get_encoding($type);
                }
                return $iconv_output_encoding;
            }
            if (_api_iconv_supports($encoding)) {
                if (@iconv_set_encoding($type, $encoding)) {
                    $iconv_output_encoding = $encoding;
                    return true;
                }
                return false;
            }
            return false;
    }
    return false;
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:65,代码来源:internationalization_internal.lib.php

示例15: testDecodeString

 public function testDecodeString()
 {
     $is = Mime\Decode::decodeQuotedPrintable('=?UTF-8?Q?"Peter M=C3=BCller"?= <peter-mueller@example.com>');
     $should = iconv('UTF-8', iconv_get_encoding('internal_encoding'), '"Peter Müller" <peter-mueller@example.com>');
     $this->assertEquals($is, $should);
 }
开发者ID:rexmac,项目名称:zf2,代码行数:6,代码来源:MessageTest.php


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