nvpy
nvpy copied to clipboard
nvPY produces strange characters in produced text files
Same problem exists with ResophNotes also.
Solution is that UTF8 text files on Windows (at least my version of Win7) need BOM-character (some Markdown editors have that as an extra option like WriteMonkey). (http://en.wikipedia.org/wiki/Byte_order_mark)
Solution for nvPY when I tried is to alter notes_db.py:
Instead of the row: "with codecs.open(fn, mode='wb', encoding='utf-8') as f:" use this row "with codecs.open(fn, mode='wb', encoding='utf-8-sig') as f: "
i.e. add the extra "-sig" text. (Thanx to this page for the solution: http://stackoverflow.com/questions/934160/write-to-utf-8-file-in-python)
Thought you might wanna add this to main track...
A minor remark: I saw that there are a couple of other places in notes_db.py using the word 'utf-8', in those places they are used when reading/opening files. Don't know if it matters, but could be best to replace all text from 'utf-8' to 'utf-8-sig' in the file notes_db.py
Another remark, there is a discussion here whether BOM shall be added or not, http://stackoverflow.com/questions/2223882/whats-different-between-utf-8-and-utf-8-without-bom
Maybe make it user selectable so those whose Windows can not handle without BOM can select it in the user config file.