Unwanted question marks after ASCII encoding of SPFILE
-
Thursday, July 03, 2008 9:48 AMHi,
I have the code as follows:
string DocUrl = "http://localhost/ NDA/Amendment/ A0001.xml";
SPWeb NdaWeb = "";
SPFile NdaFile = NdaWeb.GetFile( DocUrl);
Byte[] data = NdaFile.OpenBinary( );
String AmendmentXml = string.Empty;
System.Text. ASCIIEncoding enc = new System.Text. ASCIIEncoding( );
AmendmentXml = enc.GetString( data);
After running the above code, the string "AmendmentXml" contains the
question manrks( "? ", "?? ", "??" ) for the text where more than one space exists.
It also inserts three question marks('???') in the begining of the file.
How to avoid these unwanted question marks?
Thanks in advance,
Yasovardhan.
All Replies
-
Tuesday, July 08, 2008 4:41 AM
ASCII encoding can result in loss of data since it only account for 128 characters with ambiguous 8th bit. Your application should use UTF8Encoding, UTF32Encoding, or UnicodeEncoding.
http://msdn.microsoft.com/en-us/library/system.text.asciiencoding.aspx
-
Tuesday, July 08, 2008 8:54 AMI tried using other encoding(UTF8Encoding, UTF32Encoding, UnicodeEncoding). But still I am gettting the question marks. Is there any other solution?

