I have a .NET WCF service using WebMessageFormat.Json both its ResponseFormat and RequestFormat . The service runs on a Windows server, the client is an Android tablet.
As it turned out, the lines sent from the client to the server contain LF linebreaks ("\ n") instead of CRLF ("\ r \ n"). Since Android is based on Linux, this is not surprising. However, the data is stored in a Windows database and read by Windows clients, so I need CRLF line breaks.
Is there a more elegant way to solve this problem than manually s = s.Replace("\n", "\r\n"); every row received through WCF? Since WCF has so many options and features, I realized that there might be a hidden AutoTranslateNewlines that I missed ...
Additional Information: My service is declared like this:
[OperationContract()] [WebInvoke(ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, UriTemplate = "MyService?UserId={myUserId}")] public Reply MyService(String myUserId, Request someRequest) { ... }
where Request is a custom class with multiple String fields, some of which may contain multiple lines of text.
source share