#NEWLINE# def write( u , path ) : #NEWLINE# #INDENT# '\n    Write a unicode string to a file (as utf-8).\n\n    ' #NEWLINE# print ( ( 'writing to: %s' % path ) ) #NEWLINE# f = open ( path , 'wb' ) #NEWLINE# try : #NEWLINE# #INDENT# b = u . encode ( FILE_ENCODING ) #NEWLINE# f . write ( b ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# f . close ( )