Unix paths as bytes

Philip Jenvey pjenvey at underboss.org
Fri May 1 18:03:36 PDT 2009


UnixPath solves the issue of java.io.File treating unix paths as  
Strings (e.g. http://bugs.sun.com/view_bug.do?bug_id=4899439 ) -- but  
AFAICT not for all situations on the JVM.

For example in Jython, paths are represented by Strings, not wrapper  
objects (JRuby has wrappers but e.g. their Dir.entries() similarly  
return paths as Strings). Without access to the underlying unix path  
name as bytes we are stuck with the same old problem of garbage names  
-- UnixPaths translate their byte representation to Strings by munging  
invalid characters to the 0xFFFD replacement character.

FYI Python 3 will deal with these invalid characters by representing  
them with half surrogates (detailed in PEP 383 http://www.python.org/dev/peps/pep-0383/ 
  ) -- this allows roundtripping those invalid characters back to bytes.

Can we allow access to UnixPath's byte representation of path names  
and the reverse: the ability to create a Path object from said bytes?

--
Philip Jenvey



More information about the nio-dev mailing list