In case you find it helpful, here's a clone of the base64 command that I wrote in Go. I did it precisely because I wanted to be able to decode any encoding scheme interchangeably.
https://github.com/rogpeppe/misc/blob/master/cmd/base64/base64.go I agree that it might be useful to have some of this functionality available in the standard library. cheers, rog. On Tue, 2 Feb 2021 at 09:08, hey...@gmail.com <hey....@gmail.com> wrote: > Hi, > > I have an io.Reader whose content is encoded in base64 with encoding type > unknown. Since there shouldn't be any ambiguity between the two, is it > possible to make the base64 automatically pick the right one to decode? > > Currently I have to read everything out to pin down the encoding, which > defeats the purpose of using an io.Reader. > > Is there a solution to this problem? > > Thanks in advance. > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/0ccee37d-319e-41b3-9bfd-3dc46e0fad78n%40googlegroups.com > <https://groups.google.com/d/msgid/golang-nuts/0ccee37d-319e-41b3-9bfd-3dc46e0fad78n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAJhgacjkUUSr-dOPFU-W4vG_AXZRY_dYYe2ti-iPuu_XUL%2BNVw%40mail.gmail.com.