1 Reply Latest reply on Apr 24, 2008 11:32 AM by fabmars

    Encoding problem in custom component with RichFaces 3.2.0SR1

    fabmars

      Hello
      Until now I used RF 3.1.4/3.1.5 on JSF RI 1.2 and Facelets 1.1.14 with Glassfish v2.
      I switched to RF 3.2.0 SR1 today. All works fine except one thing: one custom JSF component I had made based on FCKeditor is now sort of "disabled". It's displayed but I cannot enter text in it or click on any button. I tried with versions 2.5.1 and 2.6 released recently.

      I checked the logs, I have this:

      Unable to set request character encoding to UTF-8 from context /WebProject, because request parameters have already been read, or ServletRequest.getReader() has already been called|#]

      But I think this is just a log not directly related to my issue although I believe the root cause of my issue is indeed an encoding problem.
      If I'm going on a page without my custom FCKeditor, i still have the UTF8 warning, but no JS error (of course).



      More interesting, in the JS console in FF, I also have the error:
      Error: this.LinkedField has no properties
      Source File: http://localhost:8080/WebProject/fckeditor/editor/js/fckeditorcode_gecko.js
      Line: 31


      "LinkedField" obviously refers to the id of the editor itself. It's understandable: when embedded in JSP/JSF, FCK editor is generated using an URL in which you pass as a url parameter the id the editor must have, so as to be able to submit the value in the good request variable later on...logic.
      This URL looks like:
      <iframe id="myForm:myField___Frame" src="/WebProject/fckeditor/editor/fckeditor.html?InstanceName=myForm:myField&Toolbar=CustomToolbarSet" width="700" height="450" frameborder="no" scrolling="no">


      From this URL you can assume the LinkedField name the error refers to is "myForm:myField". However there is the &Toolbar attribute just behind and that's where the error lies.
      With FCK editor, you may pass a custom toolbar name in the same URL. Until now, in my Html renderer of my custom FCK editor component, i used to output
      &Toolbar=...
      and the resulting URL was correctly written in the resulting Html page, and when evaluating this URL, FCK editor was assigning correctly InstanceName and Toolbar parameters to their respective values. However now, when debugging in firebug, i see InstanceName contains the value "myForm:myField%26amp;Toolbar", and of course the FCK JS script cannot find back the element "myForm:myField" with that !!

      Eventually, if I don't assign any toolbar in my editor, it's rendered correctly and editable, since there is nothing behind the InstanceName value in my URL that would alter it.


      So my problem summarizes to the following: instead of decoding my & to a & URL parameter separator, RichFaces reencoded the & of the & into %26.

      I cannot go further, I'm lost. Do you have a solution for that ?

        • 1. Re: Encoding problem in custom component with RichFaces 3.2.
          fabmars

          The post was altered with the encoded stuff i put into:

          Please read:
          Until now, in my Html renderer of my custom FCK editor component, i used to output

          & amp;Toolbar=


          and please read:
          So my problem summarizes to the following: instead of decoding my & amp; to a & URL parameter separator, RichFaces reencoded the & of the & amp; into %26.