What alternative for atob on ios?

2019-03-01 00:36发布

问题:

In my Ionic application I use the atob() command.

It works fine on chrome & android, but for some reason it does not work on iOS, is there an alternative?

回答1:

In IOS, atob does not accept space characters. So use atob like that:

var input = response.data.content;
input = input.replace(/\s/g, '');
var content = window.atob(input);

Have a look at that answer about atob