Thanks for your response.
It looks to me that this is a bug, I don't understand the rational to change
lfcr to lf otherwise.
[quoted text, click to view] "[MSFT]" wrote:
> Hello,
>
> Before sending to the web service class, the paramter string will be
> encoded and decoded, and the CR was lost during the procedure. To get
> around the issue, you can consider following ways;
>
> 1. When get the string in web service, search for LF in the string and
> replace with LF+CR.
> 2. Before send the string to web service, change its encoding to Unicode.
> For example:
>
> Encoding ascii = Encoding.ASCII;
> Encoding unicode = Encoding.Unicode;
>
> byte[] asciiBytes = ascii.GetBytes(MyString);
> byte[] unicodeBytes = Encoding.Convert(ascii,unicode, asciiBytes);
>
> char[] unicodeChars = new char[unicode.GetCharCount(unicodeBytes, 0,
> unicodeBytes.Length)];
> unicode.GetChars(unicodeBytes, 0, unicodeBytes.Length, unicodeChars, 0);
> string unicodeString = new string(unicodeChars)
>
> In this way, the string will be pass in Unicode encoding the CR won't be
> lost.
>
> On Web service side, we can use the Uncode string directly, or convert it
> to ASCII back:
>
> Encoding ascii = Encoding.ASCII;
> Encoding unicode = Encoding.Unicode;
>
> byte[] unicodeBytes = unicode.GetBytes(MyString);
> byte[] asciiBytes = Encoding.Convert(unicode, ascii, unicodeBytes);
>
> char[] asciiChars = new char[ascii.GetCharCount(asciiBytes, 0,
> asciiBytes.Length)];
> ascii.GetChars(asciiBytes, 0, asciiBytes.Length, asciiChars, 0);
> string asciiString = new string(asciiChars);
>
> Hope this help,
>
This is not only with Web service, but also all XML processor which treat
the character sequence Carriage Return-Line Feed (CRLF) like single CR or
LF characters. All are reported as a single LF character. XML is
cross-platform standard, this is designed for the compatibility with
others, such as Unix.
Hope this help,