On Tue, May 5, 2009 at 1:14 AM, Mark Tolonen <metolone+gm...@gmail.com> wrote:

> The below works.  ConfigParser isn't written to support Unicode correctly. I
> was able to get Unicode sections to write out, but it was just luck. Unicode
> keys and values break as the OP discovered.  So treat everything as byte
> strings:

Thanks for the complete example.

> files = glob.glob('*.txt')
> c.add_section('files')
>
> for i,fn in enumerate(files):
>   fn = fn.decode(sys.getfilesystemencoding())

I think if you give a Unicode string to glob.glob(), e.g.
glob.glob(u'*.txt'), then the strings returned will also be unicode
and this decode step will not be needed.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to