Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-6955

Velocity scripts doesn't work with cyrillic letters in page creation

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • Critical
    • None
    • 3.1
    • Old Core, Scripting
    • velocity scripts, page creation,
    • Unknown

    Description

      http://platform.xwiki.org/xwiki/bin/view/DevGuide/FAQTutorial

      Followng code works only with latin letters. No way to create page with cyrillic (probably not only cyrillic) letters. It says, that page already exists and sends to the page, that containing this script.

      {{velocity}}
      #if("$!request.docName" != '')
        ## Request for creating a new instance
        #set($docName = $util.clearName(${request.docName}))
        #set($targetDocName = "${request.spaceName}.${docName}")
        #if(!$xwiki.exists($targetDocName) && $xwiki.hasAccessLevel('edit', $context.user, $targetDocName))
          $response.sendRedirect($xwiki.getURL($targetDocName, 'inline', "template=${request.template}&parent=${request.parent}"))
          ## Stop processing, since we already sent a redirect.
          #stop
        #end
      #end
      
      = Add a new question =
      
      #if("$!targetDocName" != '' && $xwiki.exists($targetDocName))
        {{warning}}The target document already exists. Please choose a different name, or [[view the existing document>>$targetDocName]]{{/warning}}
      #elseif("$!targetDocName" != '')
        {{warning}}You don't have permission to create that document{{/warning}}
      #end
      
      {{html}}
        <form action="" id="newdoc" method="post">
          <div>
            <input type="hidden" name="parent" value="${doc.fullName}"/>
            <input type="hidden" name="template" value="FAQ.FAQTemplate"/>
            <input type="hidden" name="sheet" value="1"/>
            <input type="hidden" name="spaceName" value="FAQ"/>
            Document: <input type="text" name="docName" value="Enter your question here" class="withTip" size="50"/>
            <span class="buttonwrapper"><input type="submit" value="Create this FAQ" class="button"/></span>
          </div>
        </form>
      {{/html}}
      {{/velocity}}
      

      Even if remove

        #set($docName = $util.clearName(${request.docName}))
      

      and replace it by

        #set($docName = ${request.docName})
      

      Scripts gives following string in URL

      ?template=????????.TestTemplate&parent=????????.WebHome
      

      "?" instead of cyrillic letters.

      PS. The same problem ("?" instead of cyrillic letters) also gives Parent Page search suggest in edit mode, when smb wants to change parent page name.

      Attachments

        Activity

          People

            tmortagne Thomas Mortagne
            haru Dmitry Bakbardin
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: