Skip to content

Commit

Permalink
Updated readme about utf-8
Browse files Browse the repository at this point in the history
Fixed typo in javadoc (-> is bad)
  • Loading branch information
sasbury committed Oct 11, 2018
1 parent 3f667d5 commit 4ac5da7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Version 2.1 uses a simplified versioning scheme. Any issues will be fixed in the

Previous versions are still available in the repo.

### UTF-8 Subjects

The client protocol spec doesn't state the encoding on subjects. Some clients use ASCII and some use UTF-8 which matches ASCII for a-Z and 0-9. Until 2.1.2 the 2.0+ version of the Java client used ASCII for performance reasons. As of 2.1.2 you can choose to support UTF-8 subjects via the Options. Keep in mind that there is a ~10% performance penalty for UTF-8 encoding and decoding in benchmarks, but depending on your application this cost may be negligible. Also, keep in mind that not all clients support UTF-8 and test accordingly.

## Installation

The java-nats client is provided in a single jar file, with no external dependencies. See [Building From Source](#building-from-source) for details on building the library.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/nats/client/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ public Builder noEcho() {
/**
* The client protocol is not clear about the encoding for subject names. For
* performance reasons, the Java client defaults to ASCII. You can enable UTF8
* with this method. The server, written in go, treats byte->string as UTF8 by default
* with this method. The server, written in go, treats byte to string as UTF8 by default
* and should allow UTF8 subjects, but make sure to test any clients when using them.
* @return the Builder for chaining
*/
Expand Down

0 comments on commit 4ac5da7

Please sign in to comment.