Android application requests WCF service (SerializationException - related to utf-8)

Some requests from our Android application to the WCF service result in the following error:

System.Runtime.Serialization.SerializationException: failed to deserialize an object of type xxx.SaveChangesCommand. "rg rden" contains invalid UTF8 bytes. ---> System.Xml.XmlException: "rg rden" contains invalid UTF8 bytes. ---> System.Text.DecoderFallbackException: Unable to translate bytes [E6] at index 0 from the specified codepage to Unicode.

in System.Text.DecoderExceptionFallbackBuffer.Throw (Byte [] bytesUnknown, Int32 Index) with System.Text.DecoderExceptionFallbackBuffer.Fallback (byte [] bytesUnknown, Int32 Index) with System.Text.DecoderFallbackBuffer.InternalFallback (Byte * pBytes, Char * & characters) in System.Text.UTF8Encoding.FallbackInvalidByteSequence (Byte * & pSrc, Int32 ch, DecoderFallbackBuffer, Char * & pTarget) in System.Text.UTF8Encoding.GetChars (bytes * bytes, Int32 * chountC byte , Int32 charCount, DecoderNLS baseDecoder) at System.Text.UTF8Encoding.GetChars (bytes [] bytes, Int32 byteIndex, Int32 byteCount, Char [] chars, Int32 charIndex) in System.Xml.XmlConverter.ToChars (buffer Byte [], offset Int32, Int32 count, Char [] chars, Int32 charOffset)

--- End of inner exception

--- System.Xml.XmlConverter.ToChars( [] buffer, Int32 offset, Int32 count, Char [] chars, Int32 charOffset) System.Xml.XmlBufferReader.GetChars( Int32, Int32, Char [] chars) System.Xml.XmlBufferReader.GetString(Int32 offset, Int32 ) System.Xml.ValueHandle.GetString() at System.Xml.XmlBaseReader.ReadContentAsString() System.Xml.XmlBaseReader.ReadElementContentAsString() ReadArrayOfstringFromJson (XmlReaderDelegator, XmlObjectSerializerReadContextComplexJson, XmlDictionaryString, XmlDictionaryString, CollectionDataContract) System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson) System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson) System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, declateType, DataContract & dataContract) System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Int32 id, RuntimeTypeHandle TypeHandle, String , ns) ReadSaveShoppingListChangesCommandFromJson (XmlReaderDelegator, XmlObjectSerializerReadContextComplexJson, XmlDictionaryString, XmlDictionaryString []) System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson) System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(XmlReaderDelegator jsonReader, XmlObjectSerializerReadContextComplexJson) System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator reader, String name, String ns, declateType, DataContract & dataContract) System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(XmlReaderDelegator xmlReader, Type, DataContract dataContract, String name, String ns) System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(XmlReaderDelegator xmlReader, Boolean verifyObjectName) System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver)

--- ---
System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(XmlReaderDelegator reader, Boolean verifyObjectName, DataContractResolver dataContractResolver) System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(XmlDictionaryReader , Boolean verifyObjectName) System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.DeserializeRequest(Message message, Object []) System.ServiceModel.Dispatcher.DemultiplexingDispatchMessageFormatter.DeserializeRequest(Message message, Object []) System.ServiceModel.Dispatcher.UriTemplateDispatchFormatter.DeserializeRequest(Message message, Object []) System.ServiceModel.Dispatcher.DispatchOperationRuntime.DeserializeInputs(MessageRpc & rpc) System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc & rpc) System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5 (MessageRpc & rpc) System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31 (MessageRpc & rpc) System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

, :
.NET WCF UTF-8 ?
UTF-8 - , , .

, , , :
https://blogs.oracle.com/CoreJavaTechTips/entry/the_overhaul_of_java_utf

UTF-8 JDK7, JDK 6, JDK 6 11 , JDK5.0u17 1.4.2_19.

, :

HTTP_USER_AGENT: Apache-HttpClient/UNAVAILABLE (java 1.4)

Android jdk1.7.0_13

?

+4
1

, XML UTF-8. . "rg rden" UTF-8. ISO 8859-1 - .

UTF-8, :)

0

All Articles