1

I am trying to write a file in .fits format, which as best I can tell requires utf encoding, preferably utf-8. How do I write a an integer to a file in utf-8?

  • possible duplicate of [Unicode (utf8) reading and writing to files in python](http://stackoverflow.com/questions/491921/unicode-utf8-reading-and-writing-to-files-in-python) – alvas Jul 16 '13 at 13:39

1 Answers1

1

How to encode a string in utf8 for std out:

myString = "string"
string.encode('utf8')

A python post by Jon Skeet on how to write to a file with utf8:

import codecs
file = codecs.open("lol", "w", "utf-8")
file.write(u'\ufeff')
file.close()
Community
  • 1
  • 1
Stephan
  • 12,235
  • 6
  • 30
  • 60