Merged silc_1_0_branch to trunk.
[silc.git] / lib / doc / silcclient_unicode.html
1 <big><b>Unicode and UTF-8 Strings in Client Library</b></big>
2
3 <br />&nbsp;<br />
4 This document describes how the client library handles UTF-8 encoded
5 strings.  By default all strings in the SILC protocol are UTF-8 encoded.
6 All strings that are sent to server and strings that are received from the
7 server are always UTF-8 encoded.  It is application's responsibility to
8 render the strings as well as possible on the user interface.
9
10 <br />&nbsp;<br />
11 Exception to these strings are messages sent and received in
12 <a href="silcmessage-SilcMessagePayload.html">Message Payload</a>, which
13 can include practically any kind of strings with any kind of character
14 encodings, and binary data also.  If UTF-8 encoded message is sent
15 or received it is indicated with the SILC_MESSAGE_FLAG_UTF8, and
16 application can render the messages accordingly.
17
18 <br />&nbsp;<br />
19 Other strings are always UTF-8 encoded and application needs to decode
20 the strings to other character encoding if application does not support
21 UTF-8 rendering on user interface.  Also strings application sends to
22 library, such as, nicknames, channel names, server names, host names,
23 topic srings, any command argument, etc. must always be UTF-8 encoded
24 before they are sent to the library.  The <a href="silcutf8.html">UTF-8
25 routines</a> help the application developer to encode and decode
26 UTF-8 strings.
27
28 <br />&nbsp;<br />
29 The client library does not ever encode or decode strings to or from the
30 current locale.  The library always expects that all strings it receives
31 from application are already UTF-8 encoded.  The library may validate
32 certain UTF-8 strings and return error if needed.  Server may also
33 send errors in command reply if strings are not encoded properly.
34
35 <br />&nbsp;<br />
36 Nicknames and channel names in SILC are also UTF-8 encoded and can
37 include practically any kind of letters, numbers and punctuation
38 marks.  Control characters and other special characters are not allowed
39 in nickname strings, and application never receives such nicknames
40 or channel names from the library.