String textEncoded = 8. String textDecoded = 8.DecodeBase64(textEncoded) When I use the standard decoder ('Base64 Decode') option I get a long string of symbols. String textEncoded = 8.EncodeBase64("test1.") When I decode using the 'Base64 to Image Decode' option, it decodes the image properly. Public static string DecodeBase64(this encoding, string encodedText)īyte textAsBytes = 64String(encodedText) Public static string EncodeBase64(this encoding, string text)īyte textAsBytes = encoding.GetBytes(text) Base64 encoding is an encoding of binary data using bytes whose values are constrained to a well-defined 64-character subrange of the ASCII character set representing printable characters, devised at a time when sending arbitrary bytes was problematic, especially with the high bit set (byte values > 0x7f). Remark: Remember that to use Extension Method you have to (!) import the namespace with using keyword (in this case using ).Ĭode: namespace Another improvement is failing gracefully with null result for null entry - it's very useful in real life scenarios and supports equivalence for X=decode(encode(X)).Rationale is that someone may need to support different types of encodings (not only UTF8). This tool saves your time and helps to decode base64 data. ![]()
0 Comments
Leave a Reply. |