Clojure-Contrib

append-spit should only write out an encoding marker once

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Resolution: Declined
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

In clojure.contrib.duck-streams append-spit writes out encoding
markers (for UnicodeLittle for example this is a FEFF in hex)
each time it appends to a file. This should happen only when
the file is initially created.

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
"Line 1\n?Line 2\n"
The expected output is:
"Line 1\nLine 2\n"

Activity

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: