473,414 Members | 1,690 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

SoapException character encoding

Hi,

My native language is Icelandic and I´m making a web service that returns
results that contain many Icelandic characters. This works fine, however,
when I return a soap:Fault, the string in the faultstring element has the
Icelandic characters encoded like "réttindi", where "é" is an
Icelandic accented character.

Does anyone know why? If so, how do I deal with this?

Best regards,
Dadi.
Nov 23 '05 #1
5 1954
Hi,

The reason for it being XML escaped is that those characters are not
allowed 'natively' in XML text nodes. (just like the < changes into
&lt;). The encoding you see here is the 'Unicode Character Encoding'
being used.

réttindi => r + UniCodeChar(223) + ttindi

On the other side (client), this text will be XML Unescaped. Therefore
this format is only 'on the wire'.

As long as the Client can display those characters, there should be no
problem.

Hope this helps,

Marvin Smit.

On Wed, 7 Sep 2005 04:35:08 -0700, "Dadi"
<Da**@discussions.microsoft.com> wrote:
Hi,

My native language is Icelandic and I´m making a web service that returns
results that contain many Icelandic characters. This works fine, however,
when I return a soap:Fault, the string in the faultstring element has the
Icelandic characters encoded like "réttindi", where "é" is an
Icelandic accented character.

Does anyone know why? If so, how do I deal with this?

Best regards,
Dadi.


Nov 23 '05 #2
Hi Marvin,

I´m currently testing this web service with NUnit and my assertion fails due
to this problem. By your account, should the characters not be unescaped in
the test too?

In the meantime I´m using HttpUtility.Decode to get my test to pass.

TIA,
Dadi

"Marvin Smit" wrote:
Hi,

The reason for it being XML escaped is that those characters are not
allowed 'natively' in XML text nodes. (just like the < changes into
<). The encoding you see here is the 'Unicode Character Encoding'
being used.

réttindi => r + UniCodeChar(223) + ttindi

On the other side (client), this text will be XML Unescaped. Therefore
this format is only 'on the wire'.

As long as the Client can display those characters, there should be no
problem.

Hope this helps,

Marvin Smit.

On Wed, 7 Sep 2005 04:35:08 -0700, "Dadi"
<Da**@discussions.microsoft.com> wrote:
Hi,

My native language is Icelandic and I´m making a web service that returns
results that contain many Icelandic characters. This works fine, however,
when I return a soap:Fault, the string in the faultstring element has the
Icelandic characters encoded like "réttindi", where "é" is an
Icelandic accented character.

Does anyone know why? If so, how do I deal with this?

Best regards,
Dadi.


Nov 23 '05 #3
Hi,
I´m currently testing this web service with NUnit and my assertion fails due
to this problem.
Does this fail on the general exception being expected or the specific
message in the fault?

Since NUnit is a .Net implementation, and therefor uses the CLR
defined characters & strings (very close to UNICode 3.0), you will
have to use the "original fault message" in your ExpectedException
attribute. What i mean by this is the "native way of writing that text
in .Net".

r + (ALT+223) + ttindi = "r¯ttindi"

(Here we see that the newsgroups do not have the correct codepage to
display the character. In binary format however, this is still the
Chr(223). Unicode however generally uses more than 1 byte to encode a
character.

The easiest thing to do probably is; Generate the error using a
sample/test app. Grab the XML Unescaped text from the fail and
copy-paste that in your NUnit ExpectedException attribute.

In the meantime I´m using HttpUtility.Decode to get my test to pass.
Although it obviously circumvented your issue, it is not the
appropriate API for this. The string we're discussing is XML escaped,
not HTTP encoded. If you retrieve the fault info (message) from the
exception, it will be XML unescaped.

When using this, the exception class on the client side will have the
correct text in the node.

Hope this helps,

Marvin Smit.
On Thu, 8 Sep 2005 03:14:03 -0700, "Dadi"
<Da**@discussions.microsoft.com> wrote:
Hi Marvin,

I´m currently testing this web service with NUnit and my assertion fails due
to this problem. By your account, should the characters not be unescaped in
the test too?

In the meantime I´m using HttpUtility.Decode to get my test to pass.

TIA,
Dadi

"Marvin Smit" wrote:
Hi,

The reason for it being XML escaped is that those characters are not
allowed 'natively' in XML text nodes. (just like the < changes into
<). The encoding you see here is the 'Unicode Character Encoding'
being used.

réttindi => r + UniCodeChar(223) + ttindi

On the other side (client), this text will be XML Unescaped. Therefore
this format is only 'on the wire'.

As long as the Client can display those characters, there should be no
problem.

Hope this helps,

Marvin Smit.

On Wed, 7 Sep 2005 04:35:08 -0700, "Dadi"
<Da**@discussions.microsoft.com> wrote:
>Hi,
>
>My native language is Icelandic and I´m making a web service that returns
>results that contain many Icelandic characters. This works fine, however,
>when I return a soap:Fault, the string in the faultstring element has the
>Icelandic characters encoded like "réttindi", where "é" is an
>Icelandic accented character.
>
>Does anyone know why? If so, how do I deal with this?
>
>Best regards,
>Dadi.



Nov 23 '05 #4
Hi,
Does this fail on the general exception being expected or the specific
message in the fault?
It fails when I do Assert.AreEqual("...réttindi...", soapException.Message).
Since NUnit is a .Net implementation, and therefor uses the CLR
defined characters & strings (very close to UNICode 3.0), you will
have to use the "original fault message" in your ExpectedException
attribute. What i mean by this is the "native way of writing that text
in .Net".

r + (ALT+223) + ttindi = "r¯ttindi"
You mean something like Assert.AreEqual("...r&amp;#233;ttindi...",
soapException.Message)?
(Here we see that the newsgroups do not have the correct codepage to
display the character. In binary format however, this is still the
Chr(223). Unicode however generally uses more than 1 byte to encode a
character.

The easiest thing to do probably is; Generate the error using a
sample/test app. Grab the XML Unescaped text from the fail and
copy-paste that in your NUnit ExpectedException attribute.
I don´t follow - the string I get from SoapException.Message _is_ XML
escaped, not unescaped?!!?
In the meantime I´m using HttpUtility.Decode to get my test to pass.


Although it obviously circumvented your issue, it is not the
appropriate API for this. The string we're discussing is XML escaped,
not HTTP encoded.


I realize this and I only resorted to this as a temporary solution.
If you retrieve the fault info (message) from the
exception, it will be XML unescaped.

When using this, the exception class on the client side will have the
correct text in the node.
The behaviour you describe here does not match my experience. We must not be
understanding each other here?

Thanks again,
Dadi.
On Thu, 8 Sep 2005 03:14:03 -0700, "Dadi"
<Da**@discussions.microsoft.com> wrote:
Hi Marvin,

I´m currently testing this web service with NUnit and my assertion fails due
to this problem. By your account, should the characters not be unescaped in
the test too?

In the meantime I´m using HttpUtility.Decode to get my test to pass.

TIA,
Dadi

"Marvin Smit" wrote:
Hi,

The reason for it being XML escaped is that those characters are not
allowed 'natively' in XML text nodes. (just like the < changes into
<). The encoding you see here is the 'Unicode Character Encoding'
being used.

réttindi => r + UniCodeChar(223) + ttindi

On the other side (client), this text will be XML Unescaped. Therefore
this format is only 'on the wire'.

As long as the Client can display those characters, there should be no
problem.

Hope this helps,

Marvin Smit.

On Wed, 7 Sep 2005 04:35:08 -0700, "Dadi"
<Da**@discussions.microsoft.com> wrote:

>Hi,
>
>My native language is Icelandic and I´m making a web service that returns
>results that contain many Icelandic characters. This works fine, however,
>when I return a soap:Fault, the string in the faultstring element has the
>Icelandic characters encoded like "réttindi", where "é" is an
>Icelandic accented character.
>
>Does anyone know why? If so, how do I deal with this?
>
>Best regards,
>Dadi.


Nov 23 '05 #5
Hi Dadi,

Just got back from 'another week abroad'.. hence the late reply.

Is there any change you can send the string (as it should be) in a
binary format? (not loosing the special char). This way i could try &
test some myself.

Marvin Smit.

On Thu, 8 Sep 2005 08:55:03 -0700, "Dadi"
<Da**@discussions.microsoft.com> wrote:
Hi,
Does this fail on the general exception being expected or the specific
message in the fault?


It fails when I do Assert.AreEqual("...réttindi...", soapException.Message).
Since NUnit is a .Net implementation, and therefor uses the CLR
defined characters & strings (very close to UNICode 3.0), you will
have to use the "original fault message" in your ExpectedException
attribute. What i mean by this is the "native way of writing that text
in .Net".

r + (ALT+223) + ttindi = "r¯ttindi"


You mean something like Assert.AreEqual("...r&amp;#233;ttindi...",
soapException.Message)?
(Here we see that the newsgroups do not have the correct codepage to
display the character. In binary format however, this is still the
Chr(223). Unicode however generally uses more than 1 byte to encode a
character.

The easiest thing to do probably is; Generate the error using a
sample/test app. Grab the XML Unescaped text from the fail and
copy-paste that in your NUnit ExpectedException attribute.


I don´t follow - the string I get from SoapException.Message _is_ XML
escaped, not unescaped?!!?
>In the meantime I´m using HttpUtility.Decode to get my test to pass.


Although it obviously circumvented your issue, it is not the
appropriate API for this. The string we're discussing is XML escaped,
not HTTP encoded.


I realize this and I only resorted to this as a temporary solution.
If you retrieve the fault info (message) from the
exception, it will be XML unescaped.

When using this, the exception class on the client side will have the
correct text in the node.


The behaviour you describe here does not match my experience. We must not be
understanding each other here?

Thanks again,
Dadi.
On Thu, 8 Sep 2005 03:14:03 -0700, "Dadi"
<Da**@discussions.microsoft.com> wrote:
>Hi Marvin,
>
>I´m currently testing this web service with NUnit and my assertion fails due
>to this problem. By your account, should the characters not be unescaped in
>the test too?
>
>In the meantime I´m using HttpUtility.Decode to get my test to pass.
>
>TIA,
>Dadi
>
>"Marvin Smit" wrote:
>
>> Hi,
>>
>> The reason for it being XML escaped is that those characters are not
>> allowed 'natively' in XML text nodes. (just like the < changes into
>> <). The encoding you see here is the 'Unicode Character Encoding'
>> being used.
>>
>> réttindi => r + UniCodeChar(223) + ttindi
>>
>> On the other side (client), this text will be XML Unescaped. Therefore
>> this format is only 'on the wire'.
>>
>> As long as the Client can display those characters, there should be no
>> problem.
>>
>> Hope this helps,
>>
>> Marvin Smit.
>>
>> On Wed, 7 Sep 2005 04:35:08 -0700, "Dadi"
>> <Da**@discussions.microsoft.com> wrote:
>>
>> >Hi,
>> >
>> >My native language is Icelandic and I´m making a web service that returns
>> >results that contain many Icelandic characters. This works fine, however,
>> >when I return a soap:Fault, the string in the faultstring element has the
>> >Icelandic characters encoded like "réttindi", where "é" is an
>> >Icelandic accented character.
>> >
>> >Does anyone know why? If so, how do I deal with this?
>> >
>> >Best regards,
>> >Dadi.
>>
>>



Nov 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Marty McDonald | last post by:
I have a web page. It uses web service (on localhost) to get data. I'm able to get to my web service properly, data is returned. Then, via JavaScript, I HTTP post to another site. Instead of...
1
by: djmc | last post by:
Hi, In my web application, I catch SoapExceptions and check the SoapException.Message property to determine the error that occurred. For instance, when authenticating a user, if the...
18
by: james | last post by:
Hi, I am loading a CSV file ( Comma Seperated Value) into a Richtext box. I have a routine that splits the data up when it hits the "," and then copies the results into a listbox. The data also...
0
by: Boris Jurado | last post by:
Hi, I'm building a Web Service that in some conditions has to send some particular exceptions. In those cases I'm using a SoapException. The message of those exceptions includes some special...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
1
by: Nelson P. Varghese | last post by:
I am getting the following exception when trying to access a web service. Client : Windows XP SP2 (Via Proxy) An unhandled exception of type 'System.Web.Services.Protocols.SoapException'...
1
by: Mike Clark | last post by:
I have a webservice that works great on localhost, but as soon as I promote to a network server I get an exception that doesn't tell me much. There's some implementation details in this exception...
17
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, Wide character and multi-byte character are two popular encoding schemes on Windows. And wide character is using unicode encoding scheme. But each time I feel confused when...
10
by: Paul W | last post by:
Hi all, I have an application that reads data in from a text file and stores it in a database. My problem is that there are some characters in the file that aren't being handled properly. For...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.