7 Replies Latest reply on May 26, 2005 11:54 AM by Martin Giljohann

    Display of German characters

    Martin Giljohann Newbie

      Hello, I have a problem to display German umlauts in a portlet running on JBP Beta 1 (sources from the zip-file), JBoss 4.01sp1 and Fedora Core 2.

      I tried to fix it by setting the JBossRenderResponse ContentType to UTF-8 and after that to ISO-8859-1 - with little success.

      I could imagine that I need to edit some descriptor, but I really have no idea which one. Any help would be highly appreciated.

      Thanks
      Martin

        • 1. Re: Display of German characters
          Woodler Expert

          what exactly are you doing, and what is the problem? A bit moer detail would be helpful....

          • 2. Re: Display of German characters
            Martin Giljohann Newbie

            The problem was to display german characters in the rendered html output of a portlet. But it seems to be ok, after I set the encoding in the portlet jsp explicitly to

            <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>

            Furthermore I set the $LANG in fedora with similar values, and it works if my dev environment has a good day - which is not always the case unfortunately. But it seems always to be working on the redhat server, so no problem.

            Martin

            • 3. how did you changed JBossRenderResponse ContentType to UTF-8
              enkhchuluun chuluunkhuu Newbie

              Hi martingi!
              how did you changed JBossRenderResponse ContentType to UTF-8?
              I've changed all my jsp's page directive so that they have
              <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> , but i couldn't display any mongolian character, all the character were broken. when i checked the page info of FireFox browser then the Encoding was ISO-8859-1.I thinks it seems that no matter you change your jsp's enconding or character set , the result remains same because all the jsp pages are parsed by a servlet or something which has a default encoding ISO-8859-1.
              So now I've no clue how to build multilingual portal site.
              is there any body with some solution on the utf problem?

              • 4. Re: Display of German characters
                Martin Giljohann Newbie

                What I did besides setting the encoding in the JSP was changing the default encoding of my linux system to UTF-8. So if I am doing a
                # echo $LANG
                I get
                DE_de.UTF-8

                Maybe it would help if you did a similar change. Actually my guess is that my problem was not related to JBP, but more generally to JBoss because I experienced the same problem with characters in servlets on JBoss. But the strange thing is that I never had a problem with the same servlets deployed in tomcat standalone.

                If you're serving your content from a database another thing you could do is to check if the character problem is not on that side.

                Martin

                • 5. Re: Display of German characters
                  Woodler Expert

                  the portal does not set the encoding of the response, so it is up to the app server to handle that. I beliefe that it uses the underlying system encoding (which would match your observations).
                  You can change the encoding however.
                  You could modify the content type interceptor (or better: plug in your own after this one) , and set the response's encoding there.

                  disclaimer: I haven't tried this, but it should work. Not sure however if all pieces work nicely with encodings.....

                  • 6. modifying the content type interceptor doesn't work
                    enkhchuluun chuluunkhuu Newbie

                    Hi mholzner! i've tried the content type interceptor ,but it fails.
                    when i changed the MIME_GENERAL_HTML = "text/html" --> text/html;charset=utf-8, and built the source again then
                    it gives error that "content type not accepted!" ,
                    so i think it's related to setContentType method of RenderResponseImpl.java :

                    public void setContentType(String contentType)
                    {
                    int index = contentType.indexOf(';');
                    if (index != -1)
                    {
                    contentType = contentType.substring(0, index);
                    }
                    String responseContentType = resp.getContentType();
                    if (!responseContentType.equals(contentType))
                    {
                    throw new IllegalArgumentException("Content type not accepted");
                    }
                    result.setContentType(contentType);
                    }

                    it extracts only "text/hmtl" from content type (which is "text/html;charset=utf-8") and in turn it check against isAcceptedContentType method of ContentTypeInterceptor.java
                    public static final boolean isAcceptedContentType(String contentType)
                    {
                    return MIME_GENERAL_HTML.equalsIgnoreCase(contentType) | MIME_WML.equalsIgnoreCase(contentType);
                    }
                    so eventually it doesn't match of course,....

                    you mentioned creating my own plugin, but i've no idea how to create that, i just want to allow jboss portal to support asian language which require utf-8 encoding (actually mongolian language) .
                    if there are developers who supported asian language , please let me khow how to.

                    • 7. Re: Display of German characters
                      Martin Giljohann Newbie

                      Is it possible for you to render your character set from a servlet on the same JBoss AS you're using for your portlet? I am asking because I reckon that your problem is not directly related to jboss portal. If you posted your question to a more general forum about JBoss AS and servlets you could find a much bigger community for your problem - just an idea.

                      Martin