Skip to content

Commit

Permalink
Unicode docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjoes committed Nov 15, 2011
1 parent ae3963f commit 5086d33
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/index.rst
Expand Up @@ -16,6 +16,7 @@ Topics
:maxdepth: 2

migrating
unicode
multiplexed
events
acknowledgments
Expand Down
22 changes: 22 additions & 0 deletions doc/unicode.rst
@@ -0,0 +1,22 @@
Unicode
=======

TornadIO2 supports unicode for all transports. When you send something, it will be automatically
converted to the unicode (assuming that it is not unicode already).

Few rules:

1. ``send`` has following logic in place:
- If message is object or dictionary, it will be json encoded into unicode string
- If message is unicode, it will be sent as is
- If message is non-unicode, not an object and not a dictionary, it will be converted to string
and converted to unicode using utf-8 encoding. If your string is in some other encoding (multi-byte, etc),
it is up for you to handle encoding and pass your data in unicode (or utf-8 encoded).

2. ``emit`` has similar logic:
- It will convert event name into unicode string (if it is not). It is expected that event name
will only use latin characters
- All ``emit`` arguments will be json encoded into unicode string

3. All incoming messages will be automatically converted to unicode strings. You can expect to receive unicode
strings in your message handler and events.

0 comments on commit 5086d33

Please sign in to comment.