Take a look into these functions:
public static string ToBase64(this string value)
{
byte[] bytes = Encoding.Default.GetBytes(value);
return Convert.ToBase64String(bytes);
}
public static string FromBase64(this string value)
{
byte[] bytes = Convert.FromBase64String(value);
return Encoding.Default.GetString(bytes);
}
The first one converts a string to a base 64 string.
e.g.: string base64 = "Hello World!".ToBase64()
The second one returns it to a 'normal' string:
string original = base64.FromBase64()
The core functionality is in Convert.FromBase64String(string value). It returns a byte array, which has to converted to a string with Encoding. When you know the used encoding, you shuld use it and not the default (UTF-16, i think).
I tested some encodings. In you case, the string is encoded in UTF8 and results in:
â|a,á|a,å|a,ä|a,ã|a,æ|ae,č|c,é|e,è|e,ê|e,ë|e,û|u,ú|u,ü|u,ø|o,ó|o,ô|o,ö|o,ò|o,š|o,`|,'|,ł|l,ż|z
In addition to the comment to @WDS here again: Spaces should get converted to base64, too. No need for spacial handing them.