I have a python structure (dict of lists of dicts, etc) that I need to save as a json. I'm currently using this:
text = json.dumps(jsonData, indent=4, separators=(',', ': '), ensure_ascii=False)
with open(fileName,"w", encoding='UTF') as output:
print(text, file=output)
# make sure there's a blank line at the end
print('', file=output)
However, if I include the "encoding" when I want: £, I get: £ When I don't include the encoding, I get ú
from within the code, if I print out the character, I always get the correct pound sign, the only difference is in the open statement.
How do I just get python to save the pound sign?
ETA: For some reason, when I run this on a mac, it works totally fine, but on a Windows box it doesn't...
ETA Answering questions: the 2 character example was copied from emacs. The 1 character was copied from "more" on the windows commandline. This files is later read by both another python program (using json.load() and an online Ruby on Rails program... so maybe the problem is that THOSE two don't speak the same language?