Package perforce :: Module api :: Class CharSet
[frames] | no frames]

Class CharSet



object --+
         |
        CharSet

Perforce character set enumeration.

Instances of this enumeration are available as members or can be looked up from their string representation using construction syntax.

Example:
| cs1 = CharSet.UTF_8
| cs2 = CharSet('utf8')
| assert cs1 is cs2
The special CharSet instance CharSet.NOCONV defines the null character set used by non-unicode Perforce servers.

Instance Methods
 
__new__(T, S, ...)
Returns: a new object with type S, a subtype of T
 
__str__(x)
str(x)
 
decode(data)
Decode a sequence of encoded bytes into a Unicode string.
 
encode(string)
Encode a Unicode string using this character set.

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __reduce__, __reduce_ex__, __repr__, __setattr__

Class Variables
  EUCJP = <perforce.api.CharSet object at 0x009B63E0>
  ISO8859_1 = <perforce.api.CharSet object at 0x009B63B0>
  ISO8859_15 = <perforce.api.CharSet object at 0x009B6420>
  ISO8859_5 = <perforce.api.CharSet object at 0x009B6430>
  KOI8_R = <perforce.api.CharSet object at 0x009B6440>
  MACOS_ROMAN = <perforce.api.CharSet object at 0x009B6410>
  NOCONV = <perforce.api.CharSet object at 0x009B63A0>
  SHIFTJIS = <perforce.api.CharSet object at 0x009B63D0>
  UTF_16 = <perforce.api.CharSet object at 0x009B63C0>
  UTF_16_BE = <perforce.api.CharSet object at 0x009B6470>
  UTF_16_BE_BOM = <perforce.api.CharSet object at 0x009B6490>
  UTF_16_BOM = <perforce.api.CharSet object at 0x009B64A0>
  UTF_16_LE = <perforce.api.CharSet object at 0x009B6460>
  UTF_16_LE_BOM = <perforce.api.CharSet object at 0x009B6480>
  UTF_32 = <perforce.api.CharSet object at 0x009B64C0>
  UTF_32_BE = <perforce.api.CharSet object at 0x009B64E0>
  UTF_32_BE_BOM = <perforce.api.CharSet object at 0x009B6500>
  UTF_32_BOM = <perforce.api.CharSet object at 0x009B6510>
  UTF_32_LE = <perforce.api.CharSet object at 0x009B64D0>
  UTF_32_LE_BOM = <perforce.api.CharSet object at 0x009B64F0>
  UTF_8 = <perforce.api.CharSet object at 0x009B6380>
  UTF_8_BOM = <perforce.api.CharSet object at 0x009B64B0>
  UTF_8_UNCHECKED = <perforce.api.CharSet object at 0x009B6520>
  UTF_8_UNCHECKED_BOM = <perforce.api.CharSet object at 0x009B6530>
  WIN_CP_1251 = <perforce.api.CharSet object at 0x009B6450>
  WIN_US_ANSI = <perforce.api.CharSet object at 0x009B63F0>
  WIN_US_OEM = <perforce.api.CharSet object at 0x009B6400>
Properties
str or None codec
The name of the Python encoding used to encode/decode Unicode strings.

Inherited from object: __class__

Method Details

__new__(T, S, ...)

 
Returns:
a new object with type S, a subtype of T

Overrides: object.__new__

__str__(x)
(Informal representation operator)

 
str(x)
Overrides: object.__str__

decode(data)

 
Decode a sequence of encoded bytes into a Unicode string.
Parameters:
  • data (str) - The sequence of bytes to decode.
Returns:
unicode

Raises:
  • ValueError - If the string was not able to be decoded using this character set.

encode(string)

 
Encode a Unicode string using this character set.
Parameters:
  • string (unicode) - The Unicode string to encode.
Returns:
str

Raises:
  • ValueError - If the string was not able to be encoded using this character set.

Property Details

codec

The name of the Python encoding used to encode/decode Unicode strings.

May be None if this character set has no corresponding Python codec.
Type:
str or None