users@jersey.java.net

[Jersey] Re: how to preserve HTML formatting for a byte[] by Jersey client

From: Jitesh Sinha -X (jisinha - Siliconweb Inc. at Cisco) <"Jitesh>
Date: Wed, 20 Jul 2011 15:17:20 -0700

An update - this issue goes away if I put this filter mapping in my web.xml -

<filter>
                  <filter-name>charsetFilter</filter-name>
                  <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
                  <init-param>
                    <param-name>encoding</param-name>
                    <param-value>UTF-8</param-value>
                  </init-param>
        </filter>
        
        
        <filter-mapping>
                  <filter-name>charsetFilter</filter-name>
                  <url-pattern>/service/request</url-pattern>
                  </filter-mapping>


Will this create any issue for ASCII input?I presume not.

Thanks
-Jitesh


-----Original Message-----
From: Jitesh Sinha -X (jisinha - Siliconweb Inc. at Cisco)
Sent: Wednesday, July 20, 2011 11:04 AM
To: users_at_jersey.java.net
Subject: [Jersey] Re: how to preserve HTML formatting for a byte[] by Jersey client

I did exactly as Pavel suggested and I still see the issue.I tried to print the html string on both client side and server side and I see bullet points that appear completely fine on client side (like * ) are replaced on server side by characters
"â<U+0080>¢" .

Does anybody have any idea why would that happen?

Thanks
-Jitesh

-----Original Message-----
From: Tatu Saloranta [mailto:tsaloranta_at_gmail.com]
Sent: Tuesday, July 19, 2011 4:02 PM
To: users_at_jersey.java.net
Subject: [Jersey] Re: how to preserve HTML formatting for a byte[] by Jersey client

On Tue, Jul 19, 2011 at 3:02 PM, Jitesh Sinha -X (jisinha - Siliconweb
Inc. at Cisco) <jisinha_at_cisco.com> wrote:
> You may be correct - I was also confused whether it is HTMl or encoding
> issue.
> How do I get rid of this issue? Before uploading content is different
> and after uploading it is something else.

And you are sure that contents differ, comparing byte-by-byte? If so,
you need to ensure that encoding is properly declared, and that you
don't use methods that assume default encoding: for example calls like
'byte[] content = string.getBytes();' are dangerous since they use
whatever platform default encoding might be.

-+ Tatu +-