Hi,
I am haveing some problems with getting the correct XML response from a
Servlet.
I have data that contains the euro sign ( 0x80 = ?) and the string I am
trying to print out to the response definitely has the correct formatting..
Here is some sample code:
import java.io.*;
import javax.servlet.* ;
import javax.servlet.h ttp.*;
public class EncodingServlet extends HttpServlet implements
SingleThreadMod el {
private static final String CONTENT_TYPE =
"text/xml;charset='is o-8859-1'";
private static String OUTPUT_XML = "<TEST val=\"£24 / ?40\"><STRING>£ 24
/ ?40</STRING></TEST>";
//Initialize global variables
public void init() throws ServletExceptio n {
}
//Process the HTTP Get request
public void doGet(HttpServl etRequest request, HttpServletResp onse
response) throws ServletExceptio n, IOException {
response.setCon tentType(CONTEN T_TYPE);
PrintWriter out = response.getWri ter();
out.println("<? xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
out.println(OUT PUT_XML);
}
//Process the HTTP Post request
public void doPost(HttpServ letRequest request, HttpServletResp onse
response) throws ServletExceptio n, IOException {
doGet(request, response);
}
//Clean up resources
public void destroy() {
}
}
As you can see, the string contains the euro sign, but the response always
replaces it with a '?'.
I have been battling with this one all day, is there anyone that can help
me?
Steve 2 5677
Hmm... As ypou can see.. Even the NG server has re-encoded the bloody
character!
Needles to say, the char code is 0x80
Cheers.
"SPG" <st************ @nopoo.blueyond er.co.uk> wrote in message
news:ks******** *************@n ews-text.cableinet. net... Hi,
I am haveing some problems with getting the correct XML response from a Servlet. I have data that contains the euro sign ( 0x80 = ?) and the string I am trying to print out to the response definitely has the correct
formatting.. Here is some sample code:
import java.io.*; import javax.servlet.* ; import javax.servlet.h ttp.*;
public class EncodingServlet extends HttpServlet implements SingleThreadMod el { private static final String CONTENT_TYPE = "text/xml;charset='is o-8859-1'"; private static String OUTPUT_XML = "<TEST val=\"£24 /
?40\"><STRING>£ 24 / ?40</STRING></TEST>";
//Initialize global variables public void init() throws ServletExceptio n { }
//Process the HTTP Get request public void doGet(HttpServl etRequest request, HttpServletResp onse response) throws ServletExceptio n, IOException { response.setCon tentType(CONTEN T_TYPE); PrintWriter out = response.getWri ter(); out.println("<? xml version=\"1.0\" encoding=\"iso-8859-1\"?>"); out.println(OUT PUT_XML); } //Process the HTTP Post request public void doPost(HttpServ letRequest request, HttpServletResp onse response) throws ServletExceptio n, IOException { doGet(request, response); } //Clean up resources public void destroy() { } }
As you can see, the string contains the euro sign, but the response always replaces it with a '?'. I have been battling with this one all day, is there anyone that can help me?
Steve
SPG wrote: Hmm... As ypou can see.. Even the NG server has re-encoded the bloody character! Needles to say, the char code is 0x80
What character encoding are you using? In ISO 8859-15 or Unicode, the euro
sign is 164 (0xa4) IIRC.
--
Chris Gray ch***@kiffer.eu net.be
/k/ Embedded Java Solutions This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Robert Zierhofer |
last post by:
hi there,
it seems as if i can´t convert the euro and pound sign to their html
equivalents.
i tried
eregi_replace("€", "€", $haystack);
eregi_replace("£", "£", $haystack);
as well as
|
by: Iain Toft |
last post by:
I'm having problems displaying the ? euro dollar sign in XML produced
from an XSL transform.
SQL Server 2000 is used to produce XML (SELECT .. FOR XML) from a
database table containing data. The euro dollar displays fine in the
database table and in the SQL Server generated XML(snippet below) but
not in the transformed XML. In fact in this post it will probably
appear as a question mark anyway!
<transporttype>Vehicle types include...
|
by: MH |
last post by:
Thai may have been asked before but I'm new here....
How can I put the Euro symbol, ? using alt0128 in my page and get it
validated as HTML 4.01 ?
--------------
MH
|
by: gabriel |
last post by:
greetings,
I am currently working on a website where I need to print the Euro
symbol and some "oe" like in "oeuvre".
If I choose this :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >
<html
|
by: rphil |
last post by:
I have a problem, I want to enter euro sign (€) into a textbox.. but
after the postback, it is displayed as '?' .Can anybody help me with
this issue.
Thx
| |
by: kingski |
last post by:
Any idea about this ?
http://www.developerfusion.co.uk/forums/thread/114379/#114379
"Can any one help me as i am building a shopping cart and it supports
multiple currencies but while sending confirmation mail o customer it does
not show euro sign before amount he paid but it is showing a queston mark
over there. It is working fine with Dollar sign and Pound Sign but this Euro
is creating problem. "
thanks.
|
by: kingski |
last post by:
Any idea about this?
http://www.developerfusion.co.uk/forums/thread/114379/#114379
"Can any one help me as i am building a shopping cart and it supports
multiple currencies but while sending confirmation mail o customer it does
not show euro sign before amount he paid but it is showing a queston mark
over there. It is working fine with Dollar sign and Pound Sign but this Euro
is creating problem. "
thanks.
|
by: Kim |
last post by:
Inserting a record through sql (asp, msaccess textfield), inserting the euro
sign "?" shows up like a questionmark "?" in the output.
I have <%@ LANGUAGE="VBSCRIPT" CodePage=28591 LCID=2077 %at the top of the
page where the insert statement is but still the euro sign is inserted like
something else (by looking at the data in the access database the euro sign
looks like a little square "€")
Whats wrong? Kim
|
by: Georg Weiler |
last post by:
Hi,
I have a database PostgreSQL entry that includes the string €
which is the euro sign.
When I retrieve the string through a PHP SQL statement and then echo the
result to the browser, it shows the correct euro sign, but in the source
code, it still says € ...
This is a problem to me, because I generate a PDF, and in this it still
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |