aboutsummaryrefslogtreecommitdiffstats
path: root/encoding.c
diff options
context:
space:
mode:
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/encoding.c b/encoding.c
index 15a0687281..b64688e0f5 100644
--- a/encoding.c
+++ b/encoding.c
@@ -613,6 +613,8 @@ void
rb_enc_associate_index(VALUE obj, int idx)
{
enc_check_capable(obj);
+ if (rb_enc_get_index(obj) == idx)
+ return;
if (!ENC_CODERANGE_ASCIIONLY(obj) ||
!rb_enc_asciicompat(rb_enc_from_index(idx))) {
ENC_CODERANGE_CLEAR(obj);