From 7d8409907411ae2396709316e2a2d03b25fb3b31 Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Tue, 8 Apr 2014 16:54:54 +0700 Subject: [PATCH] IMPORTANT FIX: small strings weren't getting a proper UTF-8 encoding (xkihzew) `(.getBytes )` was being used here instead of `(.getBytes "UTF-8")` as is correct and done elsewhere. This means that small UTF-8 strings may have been incorrectly stored in environments where UTF-8 is not the default JVM character encoding. Bug was introduced in Nippy v2.6.0, released 9 days ago (2014 Mar 30). ********************************************************************* Please check for possible errors in Unicode text written using Nippy v2.6.0 if your JVM uses an alternative character encoding by default ********************************************************************* Really sorry about this, not sure how this slipped in. Thanks to @xkihzew for the bug report. --- CHANGELOG.md | 6 ++++++ src/taoensso/nippy.clj | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b162f3f..7dd4086 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v2.6.1 / 2014 Apr 8 + +> **CRITICAL FIX** for v2.6.0 released 9 days ago. Please upgrade ASAP! + + + ## v2.6.0 / 2014 Mar 30 > **Major release** with efficiency improvements, reliability improvements, and some new utils. diff --git a/src/taoensso/nippy.clj b/src/taoensso/nippy.clj index 0aa40ae..f63492d 100644 --- a/src/taoensso/nippy.clj +++ b/src/taoensso/nippy.clj @@ -186,7 +186,7 @@ (extend-type String ; Optimized common-case type Freezable (freeze-to-out* [x ^DataOutput out] - (let [ba (.getBytes x)] + (let [ba (.getBytes x "UTF-8")] (if (<= (alength ^bytes ba) Byte/MAX_VALUE) (do (write-id out id-string-small) (write-bytes out ba :small))