summaryrefslogtreecommitdiff
path: root/regerror.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-29 19:07:25 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-06-29 19:07:25 +0900
commit792d1deb949e8416d7a76d66771b286d35c8278d (patch)
tree6d4563e8dd42408b111fa23808f1c573643410cd /regerror.c
parent27723b699b5fbad49a7bb16936d5a7d8e80376ba (diff)
Escape control codes in regexp warning message
Diffstat (limited to 'regerror.c')
-rw-r--r--regerror.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/regerror.c b/regerror.c
index 59cf53068e..efcfefffdf 100644
--- a/regerror.c
+++ b/regerror.c
@@ -356,7 +356,8 @@ onig_vsnprintf_with_pattern(UChar buf[], int bufsize, OnigEncoding enc,
*s++ = *p++;
}
else if (!ONIGENC_IS_CODE_PRINT(enc, *p) &&
- !ONIGENC_IS_CODE_SPACE(enc, *p)) {
+ (!ONIGENC_IS_CODE_SPACE(enc, *p) ||
+ ONIGENC_IS_CODE_CNTRL(enc, *p))) {
sprint_byte_with_x((char* )bs, (unsigned int )(*p++));
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
bp = bs;