开发者

utf-8 url problem

I have a tomcat (7) server running, through which I try to access some public files by http. Some of the files on the filesystem have special characters in them. The ones without those special characters are found. The other ones give a 404. For example:

http://localhost:9090/processed/transcoded/Csángó_TÖMEGKERESZTELŐVEL_EGYBEKÖTÖTT_búcsú_Istensegítsfalvá20111053491309424029417_extracted.mp3"

From what I found out utf-8 in urls shouldn't be a problem. I've tried an url escape function on the filename, which resulted in:

http:开发者_开发百科//localhost:9090/processed/transcoded/Cs%c3%a1ng%c3%b3_T%c3%96MEGKERESZTEL%c5%90VEL_EGYBEK%c3%96T%c3%96TT_b%c3%bacs%c3%ba_Istenseg%c3%adtsfalv%c3%a120111053491309424029417_extracted%2emp3

... but that didn't seem to solve anything either. What to try next? I have no clue what the problem is. Is it maybe related to a Tomcat settings?


Do you have URIEncoding="UTF-8" in your <Connector? If yes, here's what I would do:

  1. create a test webapp which has a filter intercepting all calls to /processed/transcoded/*
  2. place a breakpoint on that filter and see what you get. Does the file name make sense when decoded?
  3. try to open a new java.io.File using this path (obviously prepending local location, e.g. /home/someuser/files/... and assuming the file is there).

I don't think tomcat does much more than what is listed above.

Another alternative would be to debug the Tomcat itself.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜