I it hard to read this kind of code. I suggest to work with Unicode as much as possible and then only do the conversion once for the whole pathRepr.

also... here the encoding should be hardcoded to utf-8 or filesystem encoding ?