[dottedmag@homenas:~]% python
Python 2.5.2 (r252:60911, Apr 18 2008, 01:19:03)
[GCC 4.3.1 20080401 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> zz = u"хуй"
>>> f = open("output", "w")
>>> f.write(zz.encode("utf-8"))
>>> f.close()
>>>
[dottedmag@homenas:~]1% cat output
хуй
[dottedmag@homenas:~]%