cambridgesu / stv-tools

A free reference implementation of Single Transferable Vote
5 stars 1 forks source link

explicitly detect and reject CRLF (and non UTF-8) #9

Open mk270 opened 7 years ago

mvl22 commented 7 years ago

Would converting CRLF to LF not be an acceptable and pragmatic normalisation?

For instance, if a Windows user downloaded a .blt file from somewhere, they could easily end up with a CRLF line -terminated file.

mk270 commented 7 years ago

The reference implementation shouldn't be pragmatic about ambiguous input. The other implementations can do that.

What do you mean by converting CRLF to LF? If you mean, run the input through "tr -d '\r'", then yes, you do need to do that on UNIX. On Windows, it expects CRLF. So in practice this will be a problem for people who are computer literate enough to compile an OCaml application on UNIX, but not literate enough to read the usage instructions or error messages.

mk270 commented 6 years ago

There should be a pragmatic pre-processor.