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

Why I cannot decode in base 64 entirely my string encoded correctly?

$
0
0
Hi all,

I am using this code from my java client to encode :

encodeBase64String(byte[] binaryData) : Encodes binary data using the base64 algorithm into 76 character blocks separated by CRLF.

http://commons.apache.org/codec/apidocs/org/apache/commons/codec/binary/Base64.html.

On the server side my c# code does not decode all characters. So i can't decode the string entirely . WHy ?

I am using this method :

http://www.vbforums.com/showthread.php?t=287324

I tried also this method but it is the same issue as the method of the previous link.


public string Decode(string encodedData)
    {
      string returnValue = "";
      try
      {
        byte[] encodedDataAsBytes

          = System.Convert.FromBase64String(encodedData);

        returnValue =

          System.Text.Encoding.UTF8.GetString(encodedDataAsBytes);
      }
      catch (Exception exception)
      {
        Console.WriteLine(exception.Message);
      }

      return returnValue;

    }


But I can decode perfectly manually with online decoder located at http://www.motobit.com/util/base64-decoder-encoder.asp


with iso 8895-1 character set.


Which c# code could decode well an encoded string with many characters (50kb for instance) ?


Thanks

Viewing all articles
Browse latest Browse all 8156

Trending Articles



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