<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">As an addition look closely at the decoding on the webside, it also fails the last two characters are missing unless you add the missing '=' to the base64 encoded data.<div><br></div><div>Regards,</div><div>Heinz<br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">--<br>Heinz N. Gies<br><a href="mailto:heinz@licenser.net">heinz@licenser.net</a><br>http://licenser.net</span>
</div>
<br><div><div>On Dec 21, 2011, at 16:44, Max Bourinov wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi guys,<div><br></div><div>Does anybody knows why base64:decode fails on strings like this:</div><div><br></div><div>eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImNyZWRpdHMiOnsib3JkZXJfZGV0YWlscyI6IntcIm9yZGVyX2lkXCI6Mjg1NTAwMDgxNTAxMTU4LFwiYnV5ZXJcIjoxMDI3NDE5NzkzLFwiYXBwXCI6MTY4MzExOTc2NTgwNDUwLFwicmVjZWl2ZXJcIjoxMDI3NDE5NzkzLFwiYW1vdW50XCI6MSxcInVwZGF0ZV90aW1lXCI6MTMyNDQ3OTA3NixcInRpbWVfcGxhY2VkXCI6MTMyNDQ3OTA3NCxcImRhdGFcIjpcIlwiLFwiaXRlbXNcIjpbe1wiaXRlbV9pZFwiOlwiMFwiLFwidGl0bGVcIjpcIkEgRmFjZWJvb2sgSGF0XCIsXCJkZXNjcmlwdGlvblwiOlwiVGhlIGNvb2xlc3QgaGF0IHlvdSd2ZSBldmVyIHNlZW4uXCIsXCJpbWFnZV91cmxcIjpcImh0dHA6XFxcL1xcXC93d3cuZmFjZWJvb2suY29tXFxcL2ltYWdlc1xcXC9naWZ0c1xcXC83NDAucG5nXCIsXCJwcm9kdWN0X3VybFwiOlwiaHR0cDpcXFwvXFxcL3d3dy5mYWNlYm9vay5jb21cXFwvaW1hZ2VzXFxcL2dpZnRzXFxcLzc0MC5wbmdcIixcInByaWNlXCI6MSxcImRhdGFcIjpcIlwifV0sXCJzdGF0dXNcIjpcInBsYWNlZFwifSIsInN0YXR1cyI6InBsYWNlZCIsIm9yZGVyX2lkIjoyODU1MDAwODE1MDExNTgsInRlc3RfbW9kZSI6MX0sImV4cGlyZXMiOjEzMjQ0ODMyMDAsImlzc3VlZF9hdCI6MTMyNDQ3OTA3Niwib2F1dGhfdG9rZW4iOiJBQUFDWkFGQ1pCVFZXSUJBQzBhYkhWb3dLRWdTVHVOQ3ZDYjRTR21hWkE4STdYc3Z0bXBZZU1hTWx3clNia0U5dkxKTHRldUdraWpNakh4aVpBVWY5am9RcG9aQ3ZWYW9YVUN6N21zU3Bjb0FuWGhKRDVRU0lRIiwidXNlciI6eyJjb3VudHJ5IjoicnUiLCJsb2NhbGUiOiJlbl9VUyIsImFnZSI6eyJtaW4iOjIxfX0sInVzZXJfaWQiOiIxMDI3NDE5NzkzIn0</div>
<div><br></div><div>You can easily decode it with online tool like this: <a href="http://www.motobit.com/util/base64-decoder-encoder.asp">http://www.motobit.com/util/base64-decoder-encoder.asp</a></div><div><br></div><div>
But lovely Erlang says:</div><div><br></div><div><div>** exception error: no function clause matching base64:decode("Jye",</div><div> [133,177,157,189,201,165,209,161,180,136,232,137,33,53,5,12,</div>
<div> 181,77,33,4,200,212,216,136,176,137,141|...])</div><div> in function base64:decode/1</div></div><div><br></div><div>Seems something wrong with pattern matching or what could it be? And most interesting question - how to find a proper work around?</div>
<div><br></div><div><br clear="all"><div>Best regards,</div><div>Max</div><br><br>
</div>
_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>http://erlang.org/mailman/listinfo/erlang-questions<br></blockquote></div><br></div></body></html>