How do I display unicode-paths?

Jp Calderone exarkun at intarweb.us
Sat Oct 4 21:29:17 EDT 2003


On Sat, Oct 04, 2003 at 08:04:33PM -0500, Pettersen, Bjorn S wrote:
> I've been trying to stay blissfully unaware of Unicode, however now it
> seems like it's my turn. From the outside it seems like a rather massive
> subject, so any pointers as to where I should _start_ reading would be
> appreciated. The usecase is a class:
> 
>   class path(object):
>      ...
>      def __str__(self):
>         return self.pathstr.encode(???)
> 
> the question is what to put at ??? to be most useful to programmers/end users?


    class Path(object):
        encoding = sys.getdefaultencoding()

        def __str__(self):
            return self.pathstr.encode(self.encoding)


  is the path (ha ha) I would take.  Unsurprising default, and easily
configurable.

  Jp





More information about the Python-list mailing list