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

Cookie with a wrong character and tomcat 7 display a blank page

    XMLWordPrintable

Details

    • Trivial
    • N/A
    • N/A
    • Awaiting Committer feedback

    Description

      Hello,

      I use XWiki.cookies.create / XWiki.cookies.read to create/read cookie but if I save a cookie with é by exemple, I obtain a blank page and this error:

      juil. 20, 2015 3:30:14 PM org.apache.coyote.ajp.AjpProcessor process
      GRAVE: Error processing request
      java.lang.IllegalArgumentException: Control character in cookie value or attribute.
              at org.apache.tomcat.util.http.CookieSupport.isHttpSeparator(CookieSupport.java:193)
      

      Here some code to test in a XWiki.JavaScriptExtension object:

      var Mycookie= 'Valué';
      XWiki.cookies.create('Cookie',Mycookie,2);
      test = XWiki.cookies.read('Cookie');
      alert(test);
      

      and the bug: http://grokbase.com/t/tomcat/users/14226p4278/cookie-issue-with-tomcat-7-does-not-accept-the-character-%C3%A9

      I know it is more a javascript + tomcat problem but it will be nice to improve
      XWiki.cookies.create/read functions with an $escapetool.xml'like function:

      encodeURIComponent(cookieValue)
      

      It will be appreciate specially when we save current page name (with accentuated characters) in a cookie.

      (Do you want I PR for https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-web/src/main/webapp/resources/js/xwiki/xwiki.js ?)

      Thxs
      Pascal B

      Attachments

        Activity

          People

            Pbas Pascal BASTIEN
            Pbas Pascal BASTIEN
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: