Magnus Pettersson wrote: >> io.open() uses UTF-8 by default, but you can specify other encodings with >> >> io.open(filepath, mode, encoding=whatever). > > > Interesting. Pydev must be doing something behind the scenes because when > i changed open() to io.open() i get error inside of eclipse now: > > f.write(card+"\n") > File "C:\python27\lib\encodings\cp1252.py", line 19, in encode > return codecs.charmap_encode(input,self.errors,encoding_table)[0] > UnicodeEncodeError: 'charmap' codec can't encode character u'\u53c8' in > position 32: character maps to <undefined> > > .... > > io.open(filepath, "a", encoding="UTF-8") as f: > > Then it works in eclipse. But I seem to be having an encoding problem all > over the place that works in eclipse but dosnt work outside of eclipse > pydev.
No, I was wrong about the default; it is actually locale.getpreferredencoding(). Sorry for the confusion. -- http://mail.python.org/mailman/listinfo/python-list