Im having an issue when I try and convert the body of an email that is given to me through the gmail api as a base64 string. Once converted to UTF-8 it should be html code which does work, but once i use an innerHTML on the page with the decoded html code string the beginning of the page looks like this:
and the bottom where most of the html and not css code looks like this:
here is my html:
<ion-header>
<ion-navbar>
<ion-title>gmail</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<!--
<ion-card>
<ion-card-content>
<ion-card-title>{{email?.payload.headers[email.payload.headers.length-4].value}}</ion-card-title>
to: {{email?.payload.headers[email.payload.headers.length-2].value}}
from: {{email?.payload.headers[email.payload.headers.length-3].value}}
{{full}}
-->
<div [innerHTML]="full"></div>
</ion-content>
here is where I convert: (I’ve also tried my own decoding functions other than “atob” but it had the same results)
this.email = data;
var body64 = this.email.payload.parts[1].body.data.replace(/\-/g, '+').replace(/\_/g, '/');
this.full = atob(body64);