You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Brian Ferris <bd...@u.washington.edu> on 2005/03/01 18:45:01 UTC

UTF-8 URIs Revisisted

I'm running CVS HEAD of WCK + Tomcat 5.0.28 and I'm having trouble  
handling UTF-8 URIs.  As prescribed in a previous messages,

http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=slide- 
user@jakarta.apache.org&msgId=1930569

I've set up my store with the three modifications:

 >> 1. Change the connector in server.xml.("useURIValidationHack="false")
 >> 2. Encoding in slide.properties should be utf-8.
 >> 3. The store had to support utf-8

However, when I request a URI with an escaped UTF-8 character, the  
string does not make it to the store properly encoded.  Specifically, a  
character like "ó" is properly encoded by my browser as %C3%B3 (UTF-8)  
when I request a given URL.  However, I don't get an equivalently  
encoded character in my store.  Specifically, String.getBytes() reports  
"3F" for the byte of the offending character.  String.getBytes("UTF-8")  
reports "EFBFBD".  Neither is what I'm looking for.  My store is very  
simple: effectively a memory based directory structure built using java  
Maps and Strings, so I don't believe this is an underlying UTF-8  
problem on my side.  Any ideas?

My full connector definition:

     <Connector port="8080"
                maxThreads="150" minSpareThreads="25"  
maxSpareThreads="75"
                enableLookups="false" redirectPort="8443"  
acceptCount="100"
                debug="0" connectionTimeout="20000"
                disableUploadTimeout="true" URIEncoding="UTF-8"   
useURIValidationHack="false" />

Thanks,
Brian Ferris




---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: UTF-8 URIs Revisisted

Posted by Jacob Lund <jl...@qualiware.net>.
Hi Brian!

The useURIValidationHack="false" is only relevant in TC4. In TC5 it is not 
secessary - dont know if that would disturb anything!

Also you may want to add JVM parameter -Dfile.encoding=UTF-8

/jacob

----- Original Message ----- 
From: "Brian Ferris" <bd...@u.washington.edu>
To: <sl...@jakarta.apache.org>
Sent: Tuesday, March 01, 2005 6:45 PM
Subject: UTF-8 URIs Revisisted


I'm running CVS HEAD of WCK + Tomcat 5.0.28 and I'm having trouble
handling UTF-8 URIs.  As prescribed in a previous messages,

http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=slide-
user@jakarta.apache.org&msgId=1930569

I've set up my store with the three modifications:

 >> 1. Change the connector in server.xml.("useURIValidationHack="false")
 >> 2. Encoding in slide.properties should be utf-8.
 >> 3. The store had to support utf-8

However, when I request a URI with an escaped UTF-8 character, the
string does not make it to the store properly encoded.  Specifically, a
character like "ó" is properly encoded by my browser as %C3%B3 (UTF-8)
when I request a given URL.  However, I don't get an equivalently
encoded character in my store.  Specifically, String.getBytes() reports
"3F" for the byte of the offending character.  String.getBytes("UTF-8")
reports "EFBFBD".  Neither is what I'm looking for.  My store is very
simple: effectively a memory based directory structure built using java
Maps and Strings, so I don't believe this is an underlying UTF-8
problem on my side.  Any ideas?

My full connector definition:

     <Connector port="8080"
                maxThreads="150" minSpareThreads="25"
maxSpareThreads="75"
                enableLookups="false" redirectPort="8443"
acceptCount="100"
                debug="0" connectionTimeout="20000"
                disableUploadTimeout="true" URIEncoding="UTF-8"
useURIValidationHack="false" />

Thanks,
Brian Ferris




---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: UTF-8 URIs Revisited = Possible Bug in WebdavUtils?

Posted by Brian Ferris <bd...@u.washington.edu>.
After examining some of the source code in  
org.apache.slide.webdav.util.WebdavUtils, I've come to the conclusion  
that Slide is ignoring some of the Tomcat connector configuration  
directives.  Specifically, I'm looking at the 'fixTomcatHeader' and  
'decodeString' methods, which are called by the 'fixTomcatURL' when  
cleaning up the request URL.  All those methods assume an input  
encoding of 'ISO-8859-1', which was at odds with my connector settings.  
  Specifically, I have URIEncoding="UTF-8".  I changed it to  
URIEncoding="ISO-8859-1" and my malformed URL problem went away.

I argue that this is a bug because my URL is encoded in UTF-8.   
Decoding it as ISO-8859-1 after Tomcat has already un-escaped it as  
UTF-8 caused the breakdown.  However, I believe changing  
URIEncoding="ISO-8859-1" caused Tomcat to incorrectly unescape the URL  
as ISO-8859-1, which in turn was reversed by the ISO-8859-1 decoding  
step, leaving the original UTF-8.  I'm basically arguing that slide  
should respect the setting of URIEncoding.  I might be totally off-base  
here, but that's how I understand it.

Anybody wish to comment?

Thanks,
Brian Ferris

On Mar 1, 2005, at 9:45 AM, Brian Ferris wrote:

> I'm running CVS HEAD of WCK + Tomcat 5.0.28 and I'm having trouble  
> handling UTF-8 URIs.  As prescribed in a previous messages,
>
> http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=slide- 
> user@jakarta.apache.org&msgId=1930569
>
> I've set up my store with the three modifications:
>
> >> 1. Change the connector in  
> server.xml.("useURIValidationHack="false")
> >> 2. Encoding in slide.properties should be utf-8.
> >> 3. The store had to support utf-8
>
> However, when I request a URI with an escaped UTF-8 character, the  
> string does not make it to the store properly encoded.  Specifically,  
> a character like "ó" is properly encoded by my browser as %C3%B3  
> (UTF-8) when I request a given URL.  However, I don't get an  
> equivalently encoded character in my store.  Specifically,  
> String.getBytes() reports "3F" for the byte of the offending  
> character.  String.getBytes("UTF-8") reports "EFBFBD".  Neither is  
> what I'm looking for.  My store is very simple: effectively a memory  
> based directory structure built using java Maps and Strings, so I  
> don't believe this is an underlying UTF-8 problem on my side.  Any  
> ideas?
>
> My full connector definition:
>
>     <Connector port="8080"
>                maxThreads="150" minSpareThreads="25"  
> maxSpareThreads="75"
>                enableLookups="false" redirectPort="8443"  
> acceptCount="100"
>                debug="0" connectionTimeout="20000"
>                disableUploadTimeout="true" URIEncoding="UTF-8"   
> useURIValidationHack="false" />
>
> Thanks,
> Brian Ferris
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: UTF-8 URIs Revisisted

Posted by Brian Ferris <bd...@u.washington.edu>.
I'm curious what you enabled in web.xml.  I haven't changed anything 
there so far.

On Mar 1, 2005, at 10:50 AM, Roman D wrote:

> I am also using HEAD WCK with Tomcat 5.0.28.
> It works fine. I didn't do any special configurations, just enabled 
> Unicode url in whatever config files that was. I think you need to 
> enable it both in web.xml and slide config.
>
> The only problem I had is with the backend, Mysql doesn't work in 
> UTF-8 by default you need to add some key to jdbc url to enable it.
>
> After that Unicode works. In Web Folders client all characters 
> diaplayed as they are, not replaced to %something. Only spaces 
> replaced to %20.
>
> Roman.


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: UTF-8 URIs Revisisted

Posted by Roman D <do...@gmail.com>.
I am also using HEAD WCK with Tomcat 5.0.28.
It works fine. I didn't do any special configurations, just enabled 
Unicode url in whatever config files that was. I think you need to 
enable it both in web.xml and slide config.

The only problem I had is with the backend, Mysql doesn't work in UTF-8 
by default you need to add some key to jdbc url to enable it.

After that Unicode works. In Web Folders client all characters diaplayed 
as they are, not replaced to %something. Only spaces replaced to %20.

Roman.

Brian Ferris wrote:
> I'm running CVS HEAD of WCK + Tomcat 5.0.28 and I'm having trouble  
> handling UTF-8 URIs.  As prescribed in a previous messages,
> 
> http://mail-archives.apache.org/eyebrowse/ReadMsg?listName=slide- 
> user@jakarta.apache.org&msgId=1930569
> 
> I've set up my store with the three modifications:
> 
>  >> 1. Change the connector in server.xml.("useURIValidationHack="false")
>  >> 2. Encoding in slide.properties should be utf-8.
>  >> 3. The store had to support utf-8
> 
> However, when I request a URI with an escaped UTF-8 character, the  
> string does not make it to the store properly encoded.  Specifically, a  
> character like "ó" is properly encoded by my browser as %C3%B3 (UTF-8)  
> when I request a given URL.  However, I don't get an equivalently  
> encoded character in my store.  Specifically, String.getBytes() reports  
> "3F" for the byte of the offending character.  String.getBytes("UTF-8")  
> reports "EFBFBD".  Neither is what I'm looking for.  My store is very  
> simple: effectively a memory based directory structure built using java  
> Maps and Strings, so I don't believe this is an underlying UTF-8  
> problem on my side.  Any ideas?
> 
> My full connector definition:
> 
>     <Connector port="8080"
>                maxThreads="150" minSpareThreads="25"  maxSpareThreads="75"
>                enableLookups="false" redirectPort="8443"  acceptCount="100"
>                debug="0" connectionTimeout="20000"
>                disableUploadTimeout="true" URIEncoding="UTF-8"   
> useURIValidationHack="false" />
> 
> Thanks,
> Brian Ferris


---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org