Created
December 17, 2011 20:28
-
-
Save blakesmith/1491274 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user=> [0xE2 0x80 0x99] | |
[226 128 153] | |
user=> (String. (into-array Integer/TYPE [0xE2 0x80 0x99]) 0 3) | |
"???" | |
user=> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was a problem with making UTF-8 strings from arrays of bytes in Clojure. The JVM only has signed byte primitives (max value 127). This doesn't work for multibyte unicode byte values that can go up to 255. The solution to this ended up requiring unchecked byte coercion... something like this: