Jahia Template Forum > Specifying encoding...

0 (0 Good)
0 (0 Bad)

Specifying encoding for Templates Jahia 5

by  darrenc »  2011/06/07 20:08

Hi,

I'm using jahia5.0.6 and have one template that I would like to return the output from encoded in ISO-8859 form instead of the default UTF-8.

I've tried setting the pageEncoding and the ContentType as normal in the JSP template but that didn't work (My response contentType and the ouput are still UTF 8).

I came across a post on an old Jahia mailing list which spoke about have to make changes to the ParamBean class to add the possibility of passing in a encodingParameter to change the default behaviour which is to return UTF-8 encoded response.

I'm reluctant to do that and start messing about with the Jahia classes themselves.

Has anyone else come across this problem and found a way around it?

Cheers in advance
Darren
  • Specifying encoding for Templates Jahia 5
    2011/06/07 20:08

    darrenc Hi,<br/><br/>I'm using jahia5.0.6 and have one template that I would like to return the output from encoded in ISO-8859 form instead of the default UTF-8.<br/><br/>I've tried setting the pageEncoding and the ContentType as normal in the JSP template but that didn't work (My response contentType and the ouput are still UTF 8).<br/><br/>I came across a post on an old Jahia mailing list which spoke about have to make changes to the ParamBean class to add the possibility of passing in a encodingParameter to change the default behaviour which is to return UTF-8 encoded response.<br/><br/>I'm reluctant to do that and start messing about with the Jahia classes themselves.<br/><br/>Has anyone else come across this problem and found a way around it?<br/><br/>Cheers in advance<br/>Darren

  • Number of messages  13
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Specifying encoding for Templates Jahia 5

    by  alexis »  2011/06/07 20:08

    Hello,
    I'm afraid you have no choice in this with jahia 5. The Parambean overwrite any encoding you might want to set with UTF8.

    Another solution would be to create a servlet dedicated to displaying your output.

    Hope it helps,
  • Re: Specifying encoding for Templates Jahia 5
    2011/06/07 20:08

    alexis Hello,<br/>I'm afraid you have no choice in this with jahia 5. The Parambean overwrite any encoding you might want to set with UTF8.<br/><br/>Another solution would be to create a servlet dedicated to displaying your output.<br/><br/>Hope it helps,

  • Number of messages  18
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Specifying encoding for Templates Jahia 5

    by  shuber »  2011/06/07 20:08

    Hello,

    If you look at the jahia.properties file, you will see the following settings :
    [code:1a2k144j]######################################################################
    ### Characters encoding ##############################################
    ######################################################################
    # Global encoding parameter, used to encode content to/from the database
    utf8Encoding = true

    # You may need to change the following values depending on the servlet
    # container you are using#46; The default values here are designed to work
    # with Tomcat

    Serge Huber (shuber)

    Number of messages  271
    Registration date
    0 (0 Good)
    0 (0 Bad)

    Re: Specifying encoding for Templates Jahia 5

    by  alexis »  2011/06/07 20:08

    Serge,
    Unfortunately these settings are global and here only one template has to set ISO-8859-1 as output encoding.

    As an example this can happen when you have to quickly cretae a csv view of some content.
    The goal of the parameter solution is to set an encoding only when needed.

    Regards,

    Alexis
  • Re: Specifying encoding for Templates Jahia 5
    2011/06/07 20:08

    alexis Serge,<br/>Unfortunately these settings are global and here only one template has to set ISO-8859-1 as output encoding.<br/><br/>As an example this can happen when you have to quickly cretae a csv view of some content.<br/>The goal of the parameter solution is to set an encoding only when needed.<br/><br/>Regards,<br/><br/>Alexis

  • Number of messages  18
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Specifying encoding for Templates Jahia 5

    by  shyrkov »  2011/06/07 20:08

    Hello Darren,

    do you have a particular URL (pattern) for that template that can be distinguished from others?

    Kind regards
    Sergiy
  • Re: Specifying encoding for Templates Jahia 5
    2011/06/07 20:08

    shyrkov Hello Darren,<br/><br/>do you have a particular URL (pattern) for that template that can be distinguished from others?<br/><br/>Kind regards<br/>Sergiy

  • Number of messages  407
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Specifying encoding for Templates Jahia 5

    by  darrenc »  2011/06/07 20:08

    Hi Sergiy,

    It's a long time ago now but yes there was a specific URL that could be used - there were 4 pages on the site that needed to be in ISO, the rest of the site was using the normal UTF-8.

    To get around the issue at the time we used just a simple jsp page with a scriplet to read the data required and output it in ISO format to bypass Jahia's UTF-8 restriction.

    Thanks
    Darren
  • Re: Specifying encoding for Templates Jahia 5
    2011/06/07 20:08

    darrenc Hi Sergiy,<br/><br/>It's a long time ago now but yes there was a specific URL that could be used - there were 4 pages on the site that needed to be in ISO, the rest of the site was using the normal UTF-8.<br/><br/>To get around the issue at the time we used just a simple jsp page with a scriplet to read the data required and output it in ISO format to bypass Jahia's UTF-8 restriction.<br/><br/>Thanks<br/>Darren

  • Number of messages  13
    Registration date Jun 7, 2011
    0 (0 Good)
    0 (0 Bad)

    Re: Specifying encoding for Templates Jahia 5

    by  alexis »  2011/06/07 20:08

    Time for some captcha? :lol:
  • Re: Specifying encoding for Templates Jahia 5
    2011/06/07 20:08

    alexis Time for some captcha? <!-- s:lol: --><img src="{SMILIES_PATH}/icon_lol.gif" alt=":lol:" title="Laughing" /><!-- s:lol: -->

  • Number of messages  18
    Registration date Jun 7, 2011
    Contact
    Share
    Feedback

    Get in touch

    Whether you are a current user or if you are just evaluating Jahia, we are here to help.

    Contact us

    Share this page