I have a C# WCF service running which needs to accept messages in ISO-8859-1. Everything works fine until someone sends a message containing a special character such as ä
or ö
.
If the characters are encoded (ä
to \344
or ä
) everything works fine, but the sender insists that if the message is otherwise ISO-8859-1, there should be no need for escaping.
More specifically, this works (simplified example):
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
a
</soap:Body>
</soap:Envelope>
(but of course throws an another exception due to invalid syntax, but the transport itself is fine).
This doesn't work:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
ä
</soap:Body>
</soap:Envelope>
And throws a bunch of cryptic error message that lead nowhere:
<ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, ...</ExceptionType>
<Message>The I/O operation has been aborted because of either a thread exit or an application request</Message>
...
<ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, ...</ExceptionType>
<Message>An operation was attempted on a nonexistent network connection</Message>
I've tried to run the service with an empty App.config and the problem persists, so I'm pretty sure the problem is not in the way I've created the service, but rather in how WCF handles the messages. Changing the encoding to UTF-8 doesn't help either.
Any idea why a single umlaut messes up the service so catastrophically? XML is supposed to support encodings other than ASCII, so what's the deal here? Is there any changes I could do or if all hope is lost, how could I convince the sender to encode their special characters?