[CONTRIB-30] append-spit should only write out an encoding marker once Created: 10/Sep/09 Updated: 24/Aug/10 Resolved: 24/Aug/10 |
|
| Status: | Closed |
| Project: | Clojure-Contrib |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | ||
| Reporter: | Anonymous | Assignee: | Stuart Halloway |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Description |
|
In clojure.contrib.duck-streams append-spit writes out encoding Test case for reproducing this behaviour: (use 'clojure.contrib.duck-streams) (binding [*default-encoding* "UnicodeLittle"] (append-spit "/foo.txt" "Line 1\n")) (binding [*default-encoding* "UnicodeLittle"] (append-spit "/foo.txt" "Line 2\n")) (slurp "c:/foo.txt" "UnicodeLittle") The slurp outputs |
| Comments |
| Comment by Assembla Importer [ 24/Aug/10 2:28 PM ] |
|
Converted from http://www.assembla.com/spaces/clojure/tickets/30 |
| Comment by Assembla Importer [ 24/Aug/10 2:28 PM ] |
|
stuart.sierra said: Updating tickets (#1, #2, #3, #4, #6, #20, #23, #25, #30, #31, #33, #34, #35, #37, #38, #52, #55, #58, #59, #60, #61, #62, #63, #64) |
| Comment by Assembla Importer [ 24/Aug/10 2:28 PM ] |
|
stu said: I am not sure there is a good answer here. The code above chooses an encoding with an explicit marker, and gets what it asks for. One proposed solution (http://github.com/sergey-miryanov/clojure-contrib/commits/bug-30) tries to detect this scenario, and recover via a hard-coded mapping between encodings-with-markers and similar-encodings-without. But I don't think this can work in general, because the set of possible encodings is open and the Charset API doesn't provide a mapping between the with-markers and without-markers versions. Sorry, and please feel free to reopen this if I am missing an obvious approach. |