• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with utf-8 encoding  RSS feed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i deploying application on tomcat server and i use to download file servlet wich calling procedure is

its working fine but, its not returning correct file name when i have non latin alphabet
but when i adding this "response.setCharacterEncoding("UTF-8");"
i getting error "Exception Details: java.nio.charset.MalformedInputException
Input length = 1"
anybody can help me? why i getting error when i adding encodding utf-8?
 
Sheriff
Posts: 21330
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please UseCodeTags next time? It makes your code so much easier to read.

This isn't the fix to your problem, but you have a bug in your file reading code:

Irakli Bliadze wrote:


That check should be > -1 instead of > 0. 0 is a valid return value of InputStream.read, it just means there's no data available right now. There is only one value that indicates there is no more data and that's -1.
 
Irakli Bliadze
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for advice about codeTag i didn't knew it.
and put >-1 instead of >0 but result is same error
 
when your children are suffering from your punishment, tell your them it will help them write good poetry when they are older. Like this tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!