We are using the UploadValues function to post a xml string to a java web
service. This has been working well for us be we are running into an issue
with using Western European characters. The service is telling us that they
are receiving "junk" in place of the European characters. We have traced
through our code and it we have verified that it is working correctly all the
way up to when we call this function. Unfortunately, so far we have been
unable to see what is being sent. My question is, can this function be
causing the characters to somehow be translated into "junk"? From my reading
it uses UTF-8 internall and therfor should not be causing a problem. Thanks
for any help!
Ken
George - 14 Jul 2005 22:08 GMT
I am not sure that my suggestion applies to your scenario. You did not provide enough info.
Here is what i have.
We have a service that returns XML as a string back to the caller. Our XML was generated from the object using XmlSerializer.
And we had similar situation like you have, we have been loosing European characters.
The problem was in the string itself.
Unfortunately XmlSerilaizer is using default encoding and you can not change it.
Here is a workaround.
---------------------
StringWriterWithEncoding sr = new StringWriterWithEncoding();
sr.SetEncoding(System.Text.ASCIIEncoding.UTF8);
XmlSerializer writeSerializer = new XmlSerializer(typeof(YOUROBJECT));
writeSerializer.Serialize(sr, doc);
--------------------------------------------------
public class StringWriterWithEncoding : StringWriter
{
private System.Text.Encoding _encoding = null;
public StringWriterWithEncoding()
{
}
public void SetEncoding( System.Text.Encoding encoding)
{
_encoding = encoding;
}
public override System.Text.Encoding Encoding
{
get
{
if( _encoding != null )
return _encoding;
else
return base.Encoding;
}
}
}
George.
We are using the UploadValues function to post a xml string to a java web
service. This has been working well for us be we are running into an issue
with using Western European characters. The service is telling us that they
are receiving "junk" in place of the European characters. We have traced
through our code and it we have verified that it is working correctly all the
way up to when we call this function. Unfortunately, so far we have been
unable to see what is being sent. My question is, can this function be
causing the characters to somehow be translated into "junk"? From my reading
it uses UTF-8 internall and therfor should not be causing a problem. Thanks
for any help!
Ken
Joerg Jooss - 16 Jul 2005 13:41 GMT
> We are using the UploadValues function to post a xml string to a java
> web service. This has been working well for us be we are running
[quoted text clipped - 7 lines]
> uses UTF-8 internall and therfor should not be causing a problem.
> Thanks for any help!
Does the receiving end really use UTF-8?
Cheers,

Signature
http://www.joergjooss.de
mailto:news-reply@joergjooss.de