[Twisted-Python] t.p.filepath and Unicode
Glyph
glyph at twistedmatrix.com
Sun Mar 8 04:26:38 MDT 2015
> On Mar 8, 2015, at 3:03 AM, Adi Roiban <adi at roiban.ro> wrote:
>
> Hi,
>
> I am trying to help porting Twisted on Py3 and for me the fact that
> FilePath requires all paths to be bytes is a constant pain.
>
> To reduce the Unicode pain when working with string my principle is to
> do all internal operations in Unicode and then convert to bytes only
> at input and output.
>
> Right now I am trying to port t.p.moduled and when using the current
> implementation of FilePath I have to constantly encode/decode path. I
> would prefer not to consider the FilePath an input/output level.
>
> Does anyone find this useful and plan to use FilePath with bytes in
> another Python3 project?
>
> What do you say if we will also have an UnicodeFilePath class which
> only accept Unicode as path input and only outputs Unicode?
>
> It can start with simple path traversal/directory creation/file
> creation just to have t.p.moduled (and trial) ported.
This approach to unicode support in FilePath is wrong, but when I went to go looking, I realized that there is no comprehensive ticket that outlines how FilePath should support unicode, so I have nothing to refer you to for how to do it correctly.
I more or less figured this out a long time ago and I have been talking about it for years, and the lack of a write-up is a terrible oversight. I'm sorry about that.
I'm going to go file a ticket now with a specification for this, and I'll post a link as soon as it's done.
-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20150308/77fac967/attachment-0002.html>
More information about the Twisted-Python
mailing list