Module: LibXML::XML::Encoding
- Defined in:
- ext/libxml/ruby_xml_encoding.c
Constant Summary collapse
- ERROR =
No char encoding detected.
-1
- NONE =
No char encoding detected.
0
- UTF_8 =
UTF-8
1
- UTF_16LE =
UTF-16 little endian.
2
- UTF_16BE =
UTF-16 big endian.
3
- UCS_4LE =
UCS-4 little endian.
4
- UCS_4BE =
UCS-4 big endian.
5
- EBCDIC =
EBCDIC uh!
6
- UCS_4_2143 =
UCS-4 unusual ordering.
7
- UCS_4_3412 =
UCS-4 unusual ordering.
8
- UCS_2 =
UCS-2.
9
- ISO_8859_1 =
ISO-8859-1 ISO Latin 1.
10
- ISO_8859_2 =
ISO-8859-2 ISO Latin 2.
11
- ISO_8859_3 =
ISO-8859-3.
12
- ISO_8859_4 =
ISO-8859-4.
13
- ISO_8859_5 =
ISO-8859-5.
14
- ISO_8859_6 =
ISO-8859-6.
15
- ISO_8859_7 =
ISO-8859-7.
16
- ISO_8859_8 =
ISO-8859-8.
17
- ISO_8859_9 =
ISO-8859-9.
18
- ISO_2022_JP =
ISO-2022-JP.
19
- SHIFT_JIS =
Shift_JIS.
20
- EUC_JP =
EUC-JP.
21
- ASCII =
pure ASCII.
22
Class Method Summary collapse
-
.from_s("UTF_8") ⇒ XML::Encoding::UTF_8
Converts an encoding string to an encoding constant defined on the XML::Encoding class.
-
.to_s(XML: :Encoding::UTF_8) ⇒ Object
Converts an encoding constant defined on the XML::Encoding class to its text representation.
Class Method Details
.from_s("UTF_8") ⇒ XML::Encoding::UTF_8
Converts an encoding string to an encoding constant defined on the XML::Encoding class.
49 50 51 52 53 54 55 56 57 58 |
# File 'ext/libxml/ruby_xml_encoding.c', line 49
static VALUE rxml_encoding_from_s(VALUE klass, VALUE encoding)
{
xmlCharEncoding xencoding;
if (encoding == Qnil)
return Qnil;
xencoding = xmlParseCharEncoding(StringValuePtr(encoding));
return INT2NUM(xencoding);
}
|
.to_s(XML: :Encoding::UTF_8) ⇒ Object
Converts an encoding constant defined on the XML::Encoding class to its text representation.
67 68 69 70 71 72 73 74 75 |
# File 'ext/libxml/ruby_xml_encoding.c', line 67
static VALUE rxml_encoding_to_s(VALUE klass, VALUE encoding)
{
const xmlChar* xencoding = (const xmlChar*)xmlGetCharEncodingName(NUM2INT(encoding));
if (!xencoding)
return Qnil;
else
return rxml_new_cstr(xencoding, xencoding);
}
|