![]() In other words, no padding, no funny chars. Base58 excludes zero, uppercase 'O', uppercase 'I', and lowercase 'l'. The allowed charset is A-Z and the digits 1-9. No need to keep track of what needs to be percent-encoded etc. Requests, along with any other decent URL library will then percent encode these for the URL for you. The correct way to do this would be to not build your URL using raw base64 encoded stuff and string concatenation. (2) These functions aren't really necessary. The result can still contain =.ĭecode () or ASCII string s using the URL- and filesystem-safe alphabet, which substitutes - instead of + and _ instead of / in the standard Base64 alphabet, and return the decoded (). (1) Instead of stripping the padding you can use the following functions: base64.urlsafe_b64encode(s)Įncode () s using the URL- and filesystem-safe alphabet, which substitutes - instead of + and _ instead of / in the standard Base64 alphabet, and return the encoded (). There are 3 things that might help and be safer. Better to let the libraries handle all of this stuff for you. I don't recommend this route as at some point the standards of something may change. ![]() So you'd have to take care of those yourself as well via string replacement. ![]() + is a special URL char (meaning a space) and / of course is another special URL char. Padding isn't the only thing that can break base64 encoding as it may use 0 - 9, a - z, A - Z, +, and /. While this is a nice workaround, I don't believe it's the "correct" way to do it anymore.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |