Image

Imageutil wrote in Imagepython_dev

to unicode from utf-8 back to utf-8 -- am I doing something pointless?

In the following, does the conversion from UTF-8 bytes to Unicode and back again do anything useful other than validating the UTF-8?
import codecs
s = foo() #byte string
u = unicode(s, 'utf-8')
out = codecs.open('test.txt', 'w', 'utf-8')
out.write("%s\n" % u)
out.close()
If I'm fairly confident about the encoding, could I just as well say the following?
out = open('test.txt', 'w')
out.write("%s\n" % foo())
out.close()
Thanks!