I have Python 2.7.1 on a Simplified-Chinese version of Windows XP, and I have a program like this(windows_prn_utf8.py):
#!/usr/bin/env python # -*- coding: u
You can encode it to utf-8 before you write it to file.
f.write("电".encode("utf8"))