diff options
Diffstat (limited to 'encoding.c')
-rw-r--r-- | encoding.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/encoding.c b/encoding.c index 67f2dd8ae9..1b0622c198 100644 --- a/encoding.c +++ b/encoding.c @@ -640,6 +640,9 @@ rb_enc_associate_index(VALUE obj, int idx) /* enc_check_capable(obj);*/ if (rb_enc_get_index(obj) == idx) return obj; + if (SPECIAL_CONST_P(obj)) { + rb_raise(rb_eArgError, "cannot set encoding"); + } if (!ENC_CODERANGE_ASCIIONLY(obj) || !rb_enc_asciicompat(rb_enc_from_index(idx))) { ENC_CODERANGE_CLEAR(obj); |