Hi,

I have currently an encoding issue, but am not really sure what's
the reason for this.

I have an url that contains a url encoded german umlaut (ü) in UTF-8
and looks like the following:

http://localhost:8080/app/search/%C3%BCbel (the %C3%BC represents the ü
in UTF-8, this url is created by
componentResources.createPageLink( "search", new Object[]{ _query } )
in the submit method of the search page)

Now, when I look in the onActivate(string) method, the string is not
"übel" but it's "?bel", both printed via logging as when I inspect the
variable during debugging.

AFAICS the created url from the page link is correct in terms of utf-8
encoding, but the parsed query string seems to be wrong, as it contains
only the "?"...

We have the following in our AppModule:

    public void contributeRequestHandler(
            OrderedConfiguration<RequestFilter> configuration,
            @InjectService("TimingFilter")
            final RequestFilter filter, @InjectService("Utf8Filter")
            final RequestFilter utf8Filter ) {
        configuration.add( "Timing", filter );
        configuration.add( "Utf8Filter", utf8Filter ); // handle UTF-8
    }

    public RequestFilter buildUtf8Filter(
            @InjectService("RequestGlobals")
            final RequestGlobals requestGlobals ) {
        return new RequestFilter() {
            public boolean service( Request request, Response response, 
RequestHandler handler ) throws IOException {
                requestGlobals.getHTTPServletRequest().setCharacterEncoding( 
"UTF-8" );
                return handler.service( request, response );
            }
        };
    }

    public static PageResponseRenderer decoratePageResponseRenderer(
            @InjectService("PageMarkupRenderer")
            final PageMarkupRenderer markupRenderer,
            @InjectService("MarkupWriterFactory")
            final MarkupWriterFactory markupWriterFactory, final Object 
delegate ) {

        return new PageResponseRenderer() {
            public void renderPageResponse( Page page, Response response )
                    throws IOException {
                MarkupWriter writer = markupWriterFactory.newMarkupWriter();
                markupRenderer.renderPageMarkup( page, writer );
                PrintWriter pw = response
                        .getPrintWriter( "text/html; charset=UTF-8" );
                writer.toMarkup( pw );
                pw.flush();
            }
        };
    }

Is there anything wrong, or what am I missing?

Thanx && cheers,
Martin


Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to