summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/encoding.c b/encoding.c
index 1453b267b2..38d2cf2c90 100644
--- a/encoding.c
+++ b/encoding.c
@@ -498,6 +498,12 @@ rb_enc_find_index(const char *name)
}
else {
i = load_encoding(name);
+ enc = rb_enc_from_index(i);
+ if (!enc->precise_mbc_enc_len) {
+ rb_warn("failed to load encoding (%s); use ASCII-8BIT instead",
+ name);
+ return 0;
+ }
}
}
return i;