codec.iconv - Palamecia/mint GitHub Wiki
Module codec.iconv
Description
load codec.iconv
This module provides the Codec.Iconv class which provide a codec to convert text using the iconv backend.
Packages
Classes
Codec.Iconv
This class use the iconv backend to convert text from and to others encodings.
load serializer.text-stream
load system.file
load codec.iconv
if let file = Serializer.TextStream(System.open(path)) {
file.setCodec(Codec.Iconv('ISO-8859-1'))
/// ...
}
Public members
| Modifiers | Member | Description |
|---|---|---|
const |
decode | Decode the characters from buffer starting at position pos. Returns an iterat... |
const |
encode | Encode the string str starting at position pos. Returns an iterator containin... |
const |
getEncoding | Returns the encoding name used by the codec. |
const |
new | Create a new instance of the codec. The encoding parameter must be a valid en... |
Private members
| Modifiers | Member | Description |
|---|---|---|
final |
d_ptr | Object data. |
final |
encoding | Internal encoding name. |
@ const |
g_lib | Global library handle. |
Descriptions
Codec.Iconv.d_ptr
null
Object data.
Codec.Iconv.decode
def (self, buffer, pos)
Decode the characters from buffer starting at position pos. Returns an iterator containing the completion
status as an instance of Codec.Status and the decoded characters. If the status is Codec.Status.Success,
no more character can be decoded from the buffer. If the status is Codec.Status.NeedMoreInput more data
should be added to continue decoding. If the status is Codec.Status.InvalidSequence, decoding can not be
continued beyond this point. On any case, pos is moved to the position of the next byte to decode. The
buffer parameter should be an instance of Serializer.DataStream.
Codec.Iconv.encode
def (self, str, pos)
Encode the string str starting at position pos. Returns an iterator containing the completion status as
an instance of Codec.Status and an instance of Serializer.DataStream containing the encoded bytes. If the
status is Codec.Status.Success, no more character need to be encoded from the string. If the status is
Codec.Status.NeedMoreInput more data should be added to continue encoding. If the status is
Codec.Status.InvalidSequence, encoding can not be continued beyond this point. On any case, pos is moved
to the position of the next byte to decode.
Codec.Iconv.encoding
'UTF-8'
Internal encoding name.
Codec.Iconv.g_lib
lib ('libmint-codec')
Global library handle.
Codec.Iconv.getEncoding
def (const self)
Returns the encoding name used by the codec.
Codec.Iconv.new
def (self, encoding)
Create a new instance of the codec. The encoding parameter must be a valid encoding name supported by
iconv.