aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/file.c b/file.c
index 9a9f5fcb90..fb62c51d7a 100644
--- a/file.c
+++ b/file.c
@@ -136,8 +136,10 @@ file_path_convert(VALUE name)
if (rb_default_internal_encoding() != NULL
&& rb_usascii_encoding() != fname_encoding
&& rb_ascii8bit_encoding() != fname_encoding
- && (fs_encoding = rb_filesystem_encoding()) != fname_encoding) {
+ && (fs_encoding = rb_filesystem_encoding()) != fname_encoding
+ && !rb_enc_str_asciionly_p(name)) {
/* Don't call rb_filesystem_encoding() before US-ASCII and ASCII-8BIT */
+ /* fs_encoding should be ascii compatible */
name = rb_str_conv_enc(name, fname_encoding, fs_encoding);
}
#endif