diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py index a8ee51d225..5e2bb266df 100644 --- a/pylib/cqlshlib/formatting.py +++ b/pylib/cqlshlib/formatting.py @@ -37,8 +37,8 @@ from .util import UTC is_win = platform.system() == 'Windows' -unicode_controlchars_re = re.compile(r'[\x00-\x31\x7f-\xa0]') -controlchars_re = re.compile(r'[\x00-\x31\x7f-\xff]') +unicode_controlchars_re = re.compile(r'[\x00-\x1f\x7f-\xa0]') +controlchars_re = re.compile(r'[\x00-\x1f\x7f-\xff]') def _show_control_chars(match): diff --git a/pylib/cqlshlib/test/test_unicode.py b/pylib/cqlshlib/test/test_unicode.py index 836c2d9b8b..9fc052f58a 100644 --- a/pylib/cqlshlib/test/test_unicode.py +++ b/pylib/cqlshlib/test/test_unicode.py @@ -22,6 +22,7 @@ import subprocess from .basecase import BaseTestCase from .cassconnect import (get_cassandra_connection, create_keyspace, testrun_cqlsh) +from cqlshlib.formatting import unicode_controlchars_re class TestCqlshUnicode(BaseTestCase): @@ -73,3 +74,6 @@ class TestCqlshUnicode(BaseTestCase): self.assertIn(v1, output) output = c.cmd_and_response('DESC TYPE "%s";' %(v1,)) self.assertIn(v2, output) + + def test_unicode_esc(self): # CASSANDRA-17617 + self.assertFalse(unicode_controlchars_re.match("01"))