Java string encoding conversion within a webpage -


I have a webpage that is encoded as WIN-1255 (its By header). A Java program creates a text string that is embedded on the page automatically. The problem is that the original string has been encoded in UTF-8, thus creating a gobbish text field in the page.

Unfortunately, I can not change page encoding - this is required by the client justification system. Any ideas?

Update:

The page I am creating is an RSS feed that is won-1255, one feed from encoded in UTF-8 Showing information taken.

Second update:

Thanks to all the responses I have been able to change the string, and so far, Gibberish. The problem was that XML encoding headers should be set apart in addition to encoding.

For the point, you need to set the encoding of the feedback author only one feedback header You are basically just pointing to the client application, which is encoding for the page to be used to interpret / display. It is not supposed to work if the feedback itself is written with a different encoding.

The context in which you have this problem is completely unclear (please expand this in detail in future problems), so here are several solutions:

If it is JSP, then you have to set the following on top of JSP to set the answer encoding:

  & lt;% @ page page encoding = "win-1255"%> gt; ;  

If this is servlet, you must set the following before flipping first to set the response encoding:

  response.setCharacterEncoding ("WIN -1255 ");  content-type  response from  charset  parameter to give instructions to automatically use the same for both clients in the  

Set the header. Encoding to interpret / display the page Also see for more information.

If this is a home based application that relies on the original code, java.net and / or java.io Created by using OutputStreamWriter , you can specify the encoding that you created:

  Author Author = New OutputStream Water (Some Output Streams, "WIN -1255 ");  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -