File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Problem in converting ANSI to UTF-8 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Problem in converting ANSI to UTF-8" Watch "Problem in converting ANSI to UTF-8" New topic

Problem in converting ANSI to UTF-8

Jitesh Sinha
Ranch Hand

Joined: Jun 19, 2004
Posts: 146
I am developing both client and service side of a Rest Web Service.
Client side is a web application that is using Jersey client api to call the service that is written using Spring's support of Rest.
Client is trying to send a file that is written using Window's notepad and saved by selecting ANSI from encoding list box that appears at the time of saving a notepad.
on Service side,I have a command class that has a field of byte[].

This is the code on server side -

My web.xml on service side has the filter set as follows -

When I check input.txt,one of the characters that belongs to extended ASCII character sets ’ (ASCII value 146) becomes garbled (? or blank square) .

In case it is needed,my client side code is as follows -

Same file when saved in Notepad using UTF-8 encoding,works absolutely fine without any complaints at all.
Can someone please help?

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Edited: Sorry, I misread your code. I don't have anything useful to say about that.
I agree. Here's the link:
subject: Problem in converting ANSI to UTF-8
It's not a secret anymore!