Preserve incoming encoding in File.basename. Fixes #2259.