Skip to content

Instantly share code, notes, and snippets.

View cameronhotchkies's full-sized avatar

Cameron Hotchkies cameronhotchkies

View GitHub Profile
@cameronhotchkies
cameronhotchkies / gist:5620426
Created May 21, 2013 14:54
Why you shouldn't go back and forth on UTF-8 strings for binary data
// Run in a REPL
val bl : List[Byte] = List(-78,-5,-112,-31,127,-59,1,94,12,7,84,112,82,41,-95,50)
val ba = bl.toArray
val bs = new String(ba, "UTF-8")
bl.length
ba.length
bs.length
// Notice they aren't all equal