While reading bytes from a file containing UTF7 encoded characters the first bracket ‘{‘ is supposed to be encoded to 123 or 007B but it is not happening.All other characters are encoded right but not ‘{‘.The code I am using is given below.
StreamReader _HistoryLocation = new StreamReader("abc.txt");
String _ftpInformation = _HistoryLocation.ReadLine();
UTF7Encoding utf7 = new UTF7Encoding();
Byte[] encodedBytes = utf7.GetBytes(_ftpInformation);
What might be the problem ?
As per RFC2152 that you reference ‘{‘ and similar characters may only optionally be encoded as directly – they may instead be encoded.
Notice that
UTF7Encodinghas an overloaded constructor with anallowOptionalsflag that will directly encode the RFC2152 optional characters.