Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 5
    can you explain a usecase where you need a base64 byte[] as byte[] ? i never in my live had this need. Commented Aug 29, 2012 at 13:04
  • 1
    Converting a string into bytes is another story. Use Encoding.ASCII.GetBytes(theString) Commented Aug 29, 2012 at 13:04
  • 2
    @robnick: that's a huge no-go. every binary data that is getting base64'd is approx. 33% larger in size. so that's not really a useful usecase. nevertheless your usecase is just covered with byte[] -> string. Commented Dec 13, 2018 at 13:10
  • 2
    @StephanSchinkel Just try to implement downloading pdf or similar formatted files via ajax requests and you will have this problem. :) E.g. you don't have the option to open a new tab or window the current window has to be uninterrupted and in focus all the way. I don't think that 33% of any similarly formatted file counts as a very bad trade-off with the bandwidths of our time. I'm not saying its the proper way. But sometimes the business requirements demand it, thus its valid. Commented Aug 16, 2019 at 20:07
  • 2
    If you need to download a pdf or "formatted file" with ajax then just download it as a binary responsetype. No reason to convert it to text. Commented Feb 19, 2020 at 22:11