Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-14176

Cannot export & import data containing no-break space (U+00A0)

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Normal
    • Resolution: Unresolved
    • Fix Version/s: None
    • Component/s: Dependencies, Legacy/Tools
    • Labels:
      None
    • Severity:
      Normal

      Description

      We were unable to export and then import the same data to Cassandra - like line breaks or the no-break space (U+00A0).

      Adding v.decode() to copyutil.py fixed most characters like line breaks etc.

      Only after using the included patch, the character U+00A0 was correctly stored in Cassandra and successfully (verifiable) exported & imported & exported.

       

      diff --git a/pylib/cqlshlib/copyutil.py b/pylib/cqlshlib/copyutil.py
      index 7f97b49..883c957 100644
      --- a/pylib/cqlshlib/copyutil.py
      +++ b/pylib/cqlshlib/copyutil.py
      @@ -1871,7 +1871,7 @@ class ImportConversion(object):
                   return bytearray.fromhex(v[2:])
       
               def convert_text(v, **_):
      -            return v
      +            return v.decode('string_escape')
       
               def convert_uuid(v, **_):
                   return UUID(v)
      diff --git a/pylib/cqlshlib/formatting.py b/pylib/cqlshlib/formatting.py
      index 803ea63..79eb691 100644
      --- a/pylib/cqlshlib/formatting.py
      +++ b/pylib/cqlshlib/formatting.py
      @@ -33,7 +33,7 @@ from util import UTC
       
       is_win = platform.system() == 'Windows'
       
      -unicode_controlchars_re = re.compile(r'[\x00-\x31\x7f-\xa0]')
      +unicode_controlchars_re = re.compile(r'[\x00-\x31]')
       controlchars_re = re.compile(r'[\x00-\x31\x7f-\xff]')
      

       

        Attachments

        1. fix.patch
          0.8 kB
          Marcel Dopita

          Activity

            People

            • Assignee:
              moneytoo Marcel Dopita
              Reporter:
              moneytoo Marcel Dopita
              Authors:
              Marcel Dopita
              Reviewers:
              Paulo Motta
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated: