Charset
== Description ==
Character sets encoding and decoding
== Synopsis ==
=== Server ===
(charset-convert obj symbol symbol)
(charset-converter symbol symbol)
(charset-converter! symbol symbol)
(iso-latin->utf8 string)
(iso-latin->utf8! string)
(utf8->iso-latin string)
(utf8->iso-latin! string)
(utf8->iso-latin-15 string)
(utf8->iso-latin-15! string)
(utf8-string->ucs2-string string)
=== Server & Client ===
(ucs2-string->utf8-string string)
== Examples ==
charset, utf8, ucs2, iso-latin, hop-locale, hop-charset
== Introduction ==
In this document, the term //charset// refers to a //character set//. A
charset is used to specified how texts are encoded. A charset is referenced
to by its name. Here is the list of charsets supported by HOP:
* UTF-8
* ISO-LATIN-1
* ISO-8859-1
* ISO-8859-2
* ISO-8859-15
* WINDOWS-1252
* UCS-2
The list of supported charsets is likely to grow with new HOP revisions.
== Server ==
=== ++(charset string charset1 charset2)++ ===
charset-convert string charset1 charset2
^ arguments ^ type ^ description ^
| string | string | The string to be translated. |
| charset1 | symbol | A charset identifier. |
| charset2 | symbol | A charset identifier. |
The function ++charset-convert++ converts a //string// from a charset
named //charset1// into an equivalent string but implemented in another
charset.
=== ++(charset-converter charset1 charset2)++ ===
=== ++(charset-converter! charset1 charset2)++ ===
charset-converter charset1 charset2
charset-converter! charset1 charset2
^ arguments ^ type ^ description ^
| charset1 | symbol | A charset identifier. |
| charset2 | symbol | A charset identifier. |
The function ++charset-converter++ returns a function that converts a
//string// from a charset named //charset1// into an equivalent string
but implemented in another charset. Hence
(charset-convert str c1 c2)
is equivalent to:
((charset-converter c1 c2) str)
is equivalent to:
((charset-converter! c1 c2) (string-copy str))
=== ++(iso-latin->utf8 string)++ ===
=== ++(iso-latin->utf8! string)++ ===
iso-latin->utf8
iso-latin->utf8!
^ arguments ^ type ^ description ^
| string | string | The string to be translated. |
Converts a string encoding with the ++ISO-LATIN-1++ charset into the
++UTF-8++ charset.
=== ++(utf8->iso-latin string)++ ===
=== ++(utf8->iso-latin! string)++ ===
=== ++(utf8->iso-latin-15 string)++ ===
=== ++(utf8->iso-latin-15! string)++ ===
utf8->iso-latin
utf8->iso-latin!
utf8->iso-latin-15
utf8->iso-latin-15!
^ arguments ^ type ^ description ^
| string | string | The string to be translated. |
Converts a string encoding with the ++UTF-8++ charset into the
++ISO-LATIN-1++ (respec. ++ISO-LATIN-15++) charset.
=== ++(utf8-string->ucs2-string string)++ ===
utf8-string->ucs2-string
^ arguments ^ type ^ description ^
| string | string | The string to be translated. |
Converts a string encoding with the ++UTF-8++ charset into the
++UCS-2++ charset.
== Server & Client Definitions ==
=== ++(ucs2-string->utf8-string string)++ ===
ucs2-string->utf8-string
ucs2-string->utf8-string
^ arguments ^ type ^ description ^
| string | string | The string to be translated. |
Converts a string encoding with the ++UCS-2++ charset into the
++UTF-8++ charset.
== See also ==
charset, ISO-LATIN, UTF-8, UCS-2