[opencms-dev] Encoding of URLs by CmsSearch.java

Robert Petermeier robert2.0 at gmx.de
Tue Apr 4 10:59:31 CEST 2006


Hi everybody,

this is what you've all been waiting for: more search-related problems;-)

I had to change the encoding of my search page from default UTF-8 to 
ISO-8859-1. I also changed the attribute 'accept-charset' in the search 
form and everything's fine... apart from the links generated by the 
CmsSearch bean (more precisely, by the methods getNextUrl(), 
getPreviousUrl() and getDisplayPages()).

For example, the german word "Lösung" (solution) should be encoded as 
"L%F6sung", but in those paging links it becomes "L%C3%B6sung", which it 
should be if UTF-8 were used. The reason is the following line in
method getSearchLinks():
     params.append(CmsEncoder.encode(query,
         OpenCms.getSystemInfo().getDefaultEncoding()));

Here, the system's default encoding is used. As a solution, I suggest to 
overload the URL-generating methods of class CmsSearch mentioned above, 
thus (optionally) allowing to specify a charset.

As a workaround, I currently use my own SearchBean which basically just 
wraps CmsSearch and generates the links.


Regards,
Robert



More information about the opencms-dev mailing list