Bast64URL Error; Invalid character

xky via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 4 08:27:53 PDT 2016


Hi! First, thank you to those who always answers.

I got some DataURL string(it's png image) like this...
================================================================================
<img src="data:image/png;base64,iVBORw0KGgoAAAA... blah blah 
blah... example==" style="position: absolute; height: 100%; 
width: 100%;" height="1080" width="750">
================================================================================





So, i used std.base64 library, and this is my test code.
================================================================================
import std.stdio;
import std.base64;

void main()
{
   string data = "iVBORw0KGgoAAAA... blah blah blah... example==";
   auto bin = Base64URL.decode( data );

   File f = File("index.png", "wb");
   f.rawWrite(bin);
   f.close();
}
================================================================================





And... get this error.
================================================================================
std.base64.Base64Exception at C:\D\dmd2\windows\bin\..\..\src\phobos\std\base64.d(1690): Invalid character: +
================================================================================





I tried finding "+" character, but i coudn't find it at original 
dataurl.
What is my problem?

Regards,


More information about the Digitalmars-d-learn mailing list