URI Encoding"

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

(Article contents added)
 
(Code samples added)
Line 1: Line 1:
 
According to [http://wiki.apache.org/tomcat/FAQ/CharacterEncoding Tomcat FAQ], for handling HTTP requests by default Tomcat uses  the ISO-8859-1 encoding.
 
According to [http://wiki.apache.org/tomcat/FAQ/CharacterEncoding Tomcat FAQ], for handling HTTP requests by default Tomcat uses  the ISO-8859-1 encoding.
  
Starting with version 5 for all <code>GET</code> requests, when the encoding type different from the default is used, the query parameters are not encoded in the same way as the request body. To be more specific, if you want to use the encoding other than the default ISO-8859-1 (like UTF-8, for example), the <code>HttpServletRequest.setCharacterEncoding("UTF-8")</code> method will only be applied to the request body, and not the URI.
+
Starting with version 5 for all <code>GET</code> requests, when the encoding type used is different from the default one, the query parameters are not encoded in the same way as the request body. To be more specific, if you want to use the encoding other than the default ISO-8859-1 (like UTF-8, for example), the <code>HttpServletRequest.setCharacterEncoding("UTF-8")</code> method will only be applied to the request body, and not the URI.
  
 
In order to encode the query parameters just like the requests, you should use the <code>URIEncoding="UTF-8"</code> attribute in the <code>Connector</code> element of the <code>Server.xml</code> file.
 
In order to encode the query parameters just like the requests, you should use the <code>URIEncoding="UTF-8"</code> attribute in the <code>Connector</code> element of the <code>Server.xml</code> file.
  
'''CKFinder uses the UTF-8 encoding, so you should stick to the guidelines presented above in order to make it work properly.'''
+
'''By default, CKFinder uses the UTF-8 encoding, so you should stick to the guidelines presented above in order to make it work properly.'''
 +
<source lang="xml">
 +
<uriEncoding>UTF-8</uriEncoding>
 +
</source>
  
 
If you cannot or do not want to set this parameter in the server configuration file, CKFinder will try to address this problem for you. This is why the <code>uriEncoding</code> configuration element was created in the <code>config.xml</code> file. This parameter accepts the encoding of your query parameters. For GlassFish, Jetty, Tomcat, and JBoss with <code>URIEncoding</code> set to UTF-8 you should set <code>uriEncoding</code> to UTF-8 as well.
 
If you cannot or do not want to set this parameter in the server configuration file, CKFinder will try to address this problem for you. This is why the <code>uriEncoding</code> configuration element was created in the <code>config.xml</code> file. This parameter accepts the encoding of your query parameters. For GlassFish, Jetty, Tomcat, and JBoss with <code>URIEncoding</code> set to UTF-8 you should set <code>uriEncoding</code> to UTF-8 as well.
  
 
For Tomcat and JBoss without the <code>URIEncoding="UTF-8"</code> set you should configure <code>uriEncoding</code> to ISO-8859-1 and CKFinder will convert the query parameters for you.
 
For Tomcat and JBoss without the <code>URIEncoding="UTF-8"</code> set you should configure <code>uriEncoding</code> to ISO-8859-1 and CKFinder will convert the query parameters for you.
 +
<source lang="xml">
 +
<uriEncoding>ISO-8859-1</uriEncoding>
 +
</source>
  
 
<note>In CKFinder for Java BETA only, when <code>URIEncoding</code> is not set to UTF-8, some problems with viewing images placed in directories containing characters other than Latin may occur. The CKFinder development team is currently working on a solution to this problem.</note>
 
<note>In CKFinder for Java BETA only, when <code>URIEncoding</code> is not set to UTF-8, some problems with viewing images placed in directories containing characters other than Latin may occur. The CKFinder development team is currently working on a solution to this problem.</note>

Revision as of 17:48, 1 April 2011

According to Tomcat FAQ, for handling HTTP requests by default Tomcat uses the ISO-8859-1 encoding.

Starting with version 5 for all GET requests, when the encoding type used is different from the default one, the query parameters are not encoded in the same way as the request body. To be more specific, if you want to use the encoding other than the default ISO-8859-1 (like UTF-8, for example), the HttpServletRequest.setCharacterEncoding("UTF-8") method will only be applied to the request body, and not the URI.

In order to encode the query parameters just like the requests, you should use the URIEncoding="UTF-8" attribute in the Connector element of the Server.xml file.

By default, CKFinder uses the UTF-8 encoding, so you should stick to the guidelines presented above in order to make it work properly.

<uriEncoding>UTF-8</uriEncoding>

If you cannot or do not want to set this parameter in the server configuration file, CKFinder will try to address this problem for you. This is why the uriEncoding configuration element was created in the config.xml file. This parameter accepts the encoding of your query parameters. For GlassFish, Jetty, Tomcat, and JBoss with URIEncoding set to UTF-8 you should set uriEncoding to UTF-8 as well.

For Tomcat and JBoss without the URIEncoding="UTF-8" set you should configure uriEncoding to ISO-8859-1 and CKFinder will convert the query parameters for you.

<uriEncoding>ISO-8859-1</uriEncoding>
important note
In CKFinder for Java BETA only, when URIEncoding is not set to UTF-8, some problems with viewing images placed in directories containing characters other than Latin may occur. The CKFinder development team is currently working on a solution to this problem.