Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: Release 1.3
-
Fix Version/s: Release 1.4
-
Component/s: None
-
Labels:
-
Environment:all
-
Patch:Code and Test
-
Approval:Ok
Description
See comments in fix:
(defmethod do-copy [InputStream Writer] [#^InputStream input #^Writer output opts]
;; WRONG! if the buffer boundry falls in the middle of a multibyte character, we will get garbled results.
#_
(let [#^"[B" buffer (make-array Byte/TYPE (buffer-size opts))]
(loop []
(let [size (.read input buffer)]
(when (pos? size)
(let [chars (.toCharArray (String. buffer 0 size (encoding opts)))]
(do (.write output chars)
(recur)))))))
;; here we decode the characters before stuffing them into the buffer
(let [#^"[C" buffer (make-array Character/TYPE (buffer-size opts))
in (InputStreamReader. input (encoding opts))]
(loop []
(let [size (.read in buffer 0 (alength buffer))]
(if (pos? size)
(do (.write output buffer 0 size)
(recur)))))))
Attachments
Activity
| Field | Original Value | New Value |
|---|---|---|
| Attachment | clj-886.diff [ 10733 ] |
| Attachment | CLJ-886-fix2.patch [ 10899 ] |
| Patch | Code [ 10001 ] | Code and Test [ 10002 ] |
| Labels | patch, |
| Environment | Mac OSX | all |
| Approval | Screened [ 10004 ] |
| Waiting On | richhickey |
| Approval | Screened [ 10004 ] | Ok [ 10007 ] |
| Fix Version/s | Release 1.4 [ 10040 ] |
| Resolution | Completed [ 1 ] | |
| Status | Open [ 1 ] | Closed [ 6 ] |
Make patch file per http://clojure.org/patches. Also sent in my CA.