convert file name to UTF-8 in common cwd segment

Proposal to fix #788