首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

UConverter (class)

Introduction

(PHP 5.5.0, PHP 7, PECL >= 3.0.0a1)

Class synopsis

UConverter {

/* Constants */

const integer REASON_UNASSIGNED = 0 ;

const integer REASON_ILLEGAL = 1 ;

const integer REASON_IRREGULAR = 2 ;

const integer REASON_RESET = 3 ;

const integer REASON_CLOSE = 4 ;

const integer REASON_CLONE = 5 ;

const integer UNSUPPORTED_CONVERTER = -1 ;

const integer SBCS = 0 ;

const integer DBCS = 1 ;

const integer MBCS = 2 ;

const integer LATIN_1 = 3 ;

const integer UTF8 = 4 ;

const integer UTF16_BigEndian = 5 ;

const integer UTF16_LittleEndian = 6 ;

const integer UTF32_BigEndian = 7 ;

const integer UTF32_LittleEndian = 8 ;

const integer EBCDIC_STATEFUL = 9 ;

const integer ISO_2022 = 10 ;

const integer LMBCS_1 = 11 ;

const integer LMBCS_2 = 12 ;

const integer LMBCS_3 = 13 ;

const integer LMBCS_4 = 14 ;

const integer LMBCS_5 = 15 ;

const integer LMBCS_6 = 16 ;

const integer LMBCS_8 = 17 ;

const integer LMBCS_11 = 18 ;

const integer LMBCS_16 = 19 ;

const integer LMBCS_17 = 20 ;

const integer LMBCS_18 = 21 ;

const integer LMBCS_19 = 22 ;

const integer LMBCS_LAST = 22 ;

const integer HZ = 23 ;

const integer SCSU = 24 ;

const integer ISCII = 25 ;

const integer US_ASCII = 26 ;

const integer UTF7 = 27 ;

const integer BOCU1 = 28 ;

const integer UTF16 = 29 ;

const integer UTF32 = 30 ;

const integer CESU8 = 31 ;

const integer IMAP_MAILBOX = 32 ;

/* Methods */

代码语言:javascript
复制
public __construct ([ string $destination_encoding [, string $source_encoding ]] )
代码语言:javascript
复制
public string convert ( string $str [, bool $reverse ] )
代码语言:javascript
复制
public mixed fromUCallback ( integer $reason , string $source , string $codePoint , integer &$error )
代码语言:javascript
复制
public static array getAliases ( string $name )
代码语言:javascript
复制
public static array getAvailable ( void )
代码语言:javascript
复制
public string getDestinationEncoding ( void )
代码语言:javascript
复制
public integer getDestinationType ( void )
代码语言:javascript
复制
public integer getErrorCode ( void )
代码语言:javascript
复制
public string getErrorMessage ( void )
代码语言:javascript
复制
public string getSourceEncoding ( void )
代码语言:javascript
复制
public integer getSourceType ( void )
代码语言:javascript
复制
public static array getStandards ( void )
代码语言:javascript
复制
public string getSubstChars ( void )
代码语言:javascript
复制
public static string reasonText ([ integer $reason ] )
代码语言:javascript
复制
public void setDestinationEncoding ( string $encoding )
代码语言:javascript
复制
public void setSourceEncoding ( string $encoding )
代码语言:javascript
复制
public void setSubstChars ( string $chars )
代码语言:javascript
复制
public mixed toUCallback ( integer $reason , string $source , string $codeUnits , integer &$error )
代码语言:javascript
复制
public static string transcode ( string $str , string $toEncoding , string $fromEncoding [, array $options ] )

}

Predefined Constants

UConverter::REASON_UNASSIGNEDUConverter::REASON_ILLEGALUConverter::REASON_IRREGULARUConverter::REASON_RESETUConverter::REASON_CLOSEUConverter::REASON_CLONEUConverter::UNSUPPORTED_CONVERTERUConverter::SBCSUConverter::DBCSUConverter::MBCSUConverter::LATIN_1UConverter::UTF8UConverter::UTF16_BigEndianUConverter::UTF16_LittleEndianUConverter::UTF32_BigEndianUConverter::UTF32_LittleEndianUConverter::EBCDIC_STATEFULUConverter::ISO_2022UConverter::LMBCS_1UConverter::LMBCS_2UConverter::LMBCS_3UConverter::LMBCS_4UConverter::LMBCS_5UConverter::LMBCS_6UConverter::LMBCS_8UConverter::LMBCS_11UConverter::LMBCS_16UConverter::LMBCS_17UConverter::LMBCS_18UConverter::LMBCS_19UConverter::LMBCS_LASTUConverter::HZUConverter::SCSUUConverter::ISCIIUConverter::US_ASCIIUConverter::UTF7UConverter::BOCU1UConverter::UTF16UConverter::UTF32UConverter::CESU8UConverter::IMAP_MAILBOX

Table of Contents

  • UConverter::__construct — Create UConverter object
  • UConverter::convert — Convert string from one charset to another
  • UConverter::fromUCallback — Default "from" callback function
  • UConverter::getAliases — Get the aliases of the given name
  • UConverter::getAvailable — Get the available canonical converter names
  • UConverter::getDestinationEncoding — Get the destination encoding
  • UConverter::getDestinationType — Get the destination converter type
  • UConverter::getErrorCode — Get last error code on the object
  • UConverter::getErrorMessage — Get last error message on the object
  • UConverter::getSourceEncoding — Get the source encoding
  • UConverter::getSourceType — Get the source convertor type
  • UConverter::getStandards — Get standards associated to converter names
  • UConverter::getSubstChars — Get substitution chars
  • UConverter::reasonText — Get string representation of the callback reason
  • UConverter::setDestinationEncoding — Set the destination encoding
  • UConverter::setSourceEncoding — Set the source encoding
  • UConverter::setSubstChars — Set the substitution chars
  • UConverter::toUCallback — Default "to" callback function
  • UConverter::transcode — Convert string from one charset to another

← IntlPartsIterator::getBreakIterator

UConverter::__construct →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com