Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Decoding the encoded string is not getting the special characters correctly

$
0
0

Hi,

I am using the below code to encode the content of *.ser file

foreach(string file inDirectory.EnumerateFiles("","*.SER")){byte[] content =File.ReadAllBytes( file ); xmlWriter.WriteStartElement("SerializedFile"); xmlWriter.WriteElementString("FileName",Path.GetFileName(file)); xmlWriter.WriteElementString("Content",System.Convert.ToBase64String( content )); xmlWriter.WriteEndElement();}

Now i have to decode the encoded content and create *.ser file, i tried with below code but the size of original *.ser file and generated *.ser file after i decode differs and if i check the content i can see some difference with the special characters.

encodedContent = xmlnode[i].ChildNodes.Item(1).InnerText;
                byte[] data = Convert.FromBase64String(encodedContent);
                string decodedContent = Encoding.UTF8.GetString(data);

Please help me out to solve this issue. Thanks in advance.

Regards,

Chetan.


Chetan Rajakumar


Viewing all articles
Browse latest Browse all 8156

Trending Articles


Practice Sheet of Right form of verbs for HSC Students


Sarah Samis, Emil Bove III


ZARIA CUMMINGS


Need radio code for IVECO Delphi Aptiv FJ5 RBT M16


Black Angus Grilled Artichokes


Ed Sheeran – Sapphire – Pre-Single [iTunes Plus M4A]


Sunny Garcia’s Ex-Wife Colleen McCullough


99 God Status for Whatsapp, Facebook


Funeral of Sir Warwick Franklin


MHDD



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>