Home > Back-end >  Decoding base64 string picture prompt error: no mapping for the unicode character exists in the targ
Decoding base64 string picture prompt error: no mapping for the unicode character exists in the targ

Time:11-27

The picture of the base64 string, I use xe10 EncdDecd DecodeString decoding errors:

No mapping for the unicode character exists in the target - byte code page

Masters please teach you???
I good reduction for pictures after decoding

CodePudding user response:

I use Delphi2010 encapsulates the decoding function, XE10 didn't try,
 

The class function Base64DecodeImageFile (fileName: string; EncodeStr: AnsiString) : Boolean;
Var
BTS: TBytes;
Ms: TMemoryStream;
Decoder: TIdDeCoderMIME;
The begin
Decoder:=TIdDeCoderMIME. Create (nil);
Ms:=TMemoryStream. The Create ();
Try
BTS:=decoder. DecodeBytes (encodeStr);
Ms. Write (BTS [0], Length (BTS));
Ms. SaveToFile (fileName);
Result:=true;
Except,
Result:=false;
end;
Decoder. Free;
Ms. The Free;
end;
  • Related