Sebastian Suchanowski Programmer's notes


Invalid length for a Base-64 char array

Lately I am working on iDoc24 stuff ( and and this is my major responsibility for the moment – but not only iOS apps but also taking care of backend system (which was originally written in – bleh! :p). I’ve encountered a lot of issues there and I’d like to share them with you.

Here is the most important line from stack trace I’ve got

at System.Convert.FromBase64String(String s)

Apparently there is some issue regarding space sign – urlDecode replaces all ‘+’ chars with ‘ ‘ which cause the error. Quick and simple solution presented bellow will make your string base 64 compatible again.

Convert.FromBase64String(encodedStr.Replace(" ", "+"))

This post is also available in: Polish

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment


No trackbacks yet.