The input is not a valid Base-64 string as it contains a non-base64 character

后端 未结 11 1756
难免孤独
难免孤独 2020-11-27 14:37

I have a REST service that reads a file and sends it to another console application after converting it to Byte array and then to Base64 string. This part works, but when th

11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-27 15:32

    As Alex Filipovici mentioned the issue was a wrong encoding. The file I read in was UTF-8-BOM and threw the above error on Convert.FromBase64String(). Changing to UTF-8 did work without problems.

提交回复
热议问题