Returns a encoded string of ascii characters that are URI safe
Syntax
Visual Basic (Declaration) | |
---|
Public Shared Function EncodeBytes( _
ByVal inData() As Byte _
) As String |
Parameters
- inData
Example
Library/Library.Test/TestSafe64Encoding.cs
C# | Copy Code |
---|
//char count must by multiple of 4 for the compare to work
string encoded = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
byte[] data = Safe64Encoding.DecodeBytes(encoded);
Assert.AreEqual(encoded, Safe64Encoding.EncodeBytes(data));
data = AsciiEncoder.DecodeBytes(encoded);
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data));
data = AsciiEncoder.DecodeBytes(Encoding.ASCII.GetBytes(encoded));
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data)); |
VB.NET | Copy Code |
---|
'char count must by multiple of 4 for the compare to work
Dim encoded As String = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
Dim data As Byte() = Safe64Encoding.DecodeBytes(encoded)
Assert.AreEqual(encoded, Safe64Encoding.EncodeBytes(data))
data = AsciiEncoder.DecodeBytes(encoded)
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data))
data = AsciiEncoder.DecodeBytes(Encoding.ASCII.GetBytes(encoded))
Assert.AreEqual(encoded, AsciiEncoder.EncodeBytes(data)) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also