Tuesday, 29 May 2018

In Javascript, how do I decode a string in which decoded string contains binary (e.g. non UTF-8) data?

I have a base64 string that represents binary data (e.g. not a nice readable string after you decode it or UTF-8 data otherwise this answer would help me -- Using Javascript's atob to decode base64 doesn't properly decode utf-8 strings). My JS Is

var byteCharacters = atob(base64str);

which results in

InvalidCharacterError: Failed to execute 'atob' on 'WorkerGlobalScope': The string to be decoded contains characters outside of the Latin1 range.

How do I decode a base 64 string that is not ASCII (or even UTF-8 data)?



from In Javascript, how do I decode a string in which decoded string contains binary (e.g. non UTF-8) data?

No comments:

Post a Comment