Extract path calculation

--HG--
extra : rebase_source : 65fdae04064b261e9076c2d05fea52d7a76407b1
Open files with utf-8 even if the OS isn't predisposed to assuming UTF-8 (such as on Ubuntu)
Merge with dist-fixes