function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

please help: b64 problem google chart api

Ran the following via an anonymous block. Said:Unrecognized base64 character: � (actually a diamond shaped thing)

The returned value that is anticipated as being a png file is not in a format that can be converted into a b64 file accurately. Does anyone know any methods that might be able to produce a correct b64 string/blob?

If anyone knew how to fix this or had sample code for getting images from google chart api, i would appreciate it.

thank you


HttpRequest req = new HttpRequest();



Http http = new Http();

HTTPResponse res = http.send(req);

blob body;

 //body = blob.valueof(res.getBody());//produces corrupted body

 body = EncodingUtil.base64Decode(res.getBody()); //crashes




it became apparent that the data returned was encrypted and would ordinarily be decrypted by the browser for display. Hence the difficulties with the blob conversion. I hadn't noticed the part of the header that indicated this. I haven't located the methods to decrypt this thing yet, rather had adopted an alternative approach.


I had same problem,  I was under the impression the responce from google chart was not base64 but the binary representation of the image.


Did you manage to solve this?  I am trying to get a jpg from a URL and save it as an attachment, bu tam getting a similar issue.