Re: SoapException character encoding



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"
<Dadi@xxxxxxxxxxxxxxxxxxxxxxxxx> 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"
>> <Dadi@xxxxxxxxxxxxxxxxxxxxxxxxx> 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"
>> >> <Dadi@xxxxxxxxxxxxxxxxxxxxxxxxx> 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.
>> >>
>> >>
>>
>>

.



Relevant Pages

  • Re: unicode
    ... No. print does nothing if the object is already a string or unicode ... If encodecan't convert a character, ... This is what str() does, ... That, in turn, may raise an exception (in particular if ...
    (comp.lang.python)
  • Re: Retrieving dbcc_name string from a DEV_BROADCAST_DEVICEINTERFACE structure
    ... >the dbcc_name string in a String variable. ... >followed by an extra null character. ... >dbcc_name is declared as a Char array, ... > An unhandled exception of type 'System.ArgumentException' occurred ...
    (microsoft.public.dotnet.languages.vb)
  • RE: How to read info from xml in asp.net component ?
    ... it has a single backslash "\" character. ... interpret the backslash as an escape and apply it to the following character. ... cause an exception, but at least give you unexpected behaviour. ... What do you do with the string once you have read it in from the config file? ...
    (microsoft.public.dotnet.general)
  • Re: ADO exception with character combination inside string...
    ... Somewhere after the " there is also a: character ... SQLString: string; ... The exception message when the error occurs is this: ... contains somewhere first a " char and later a: ...
    (borland.public.delphi.database.ado)
  • Re: set character at string position
    ... binary format returns a string too, ... >> if it's an UTF-8 character that can not be represented with a single ... > The confusion stems from C's char data type, ...
    (comp.lang.tcl)

Quantcast