Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-484

Unable to compile pattern defined in module when using Unicode blocks

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 4079

    Description

      Given Yang snippet:

      type string {
      pattern "(\p

      {IsBasicLatin}|\p{IsLatin-1Supplement})*";
      }

      evokes:

      [WARNING] Unable to compile pattern defined in module <name> at line <line>. Error message: Unknown character script name {BasicLatin} near index <column>
      ^(\p{IsBasicLatin}

      |\p

      {IsLatin-1Supplement}

      )*$

      Poblem comes from the fact that in the XML Schema specification,
      Unicode character blocks are matched by "\p

      {Is...}

      " [1],
      whereas Java expects "\p

      {In...}

      " [2].

      [1] http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#nt-IsBlock
      [2] http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html

      This needs to be fixed.

      For time being, these are two possible workarounds:

      1)
      type string {
      pattern "(\p

      {InBasicLatin}

      |\p

      {InLatin-1Supplement}

      )*
      }

      2)
      type string {
      pattern "([\x00-\x7F]|[\x80-\xFF])*
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ifoltin Igor Foltin
            martin.ciglan Martin Ciglan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: