3 ms·
I would like to counter-argue that it's the author's fault for doing things the wrong way. While I'm sure the actual code looked different, the "spirit" of the
by probably_wrong 3y ago
I would like to counter-argue that it's the author's fault for doing things the wrong way.
While I'm sure the actual code looked different, the "spirit" of the code builds a CSV file by concatenating strings and specifying raw ASCII codes. Building a CSV file like this on 2023 is guaranteed to cause bugs down the line.
Had the code used the Python CSV primitives, or at least had the author let Python convert the "\n" character to the OS-dependent representation, the bug would have been avoided entirely. The author just happened to run into it with `cat` instead of, say, a CSV parser confused about the unusual choice.
- kevin_thibedeau 3y agoIt's ColdFusion, not Python. A language that forces you to program like it's the 60s because character escapes are too advanced a concept to implement.
- kevincox 3y agoThe author says it was a simplified example. They may will have implement a fully features CSV emitter but got the liver separator wrong. Either way whether or not their CSV was valid is irrelevant to the story. The point is that some characters in a file may obscure the contents of that file in surprising ways.