Fix filename_escape for v2.x xlat API
Port detail fixes from v3.0.x