Link to home
Start Free TrialLog in
Avatar of Alex Lord
Alex Lord

asked on

64Decode stuck

\u003cii_jtobx3m60\u003e

Open in new window


here is the sample im trying to decode,

this is where it comes from,  Gmail api
User generated image
 'body' => $getGmailService->gmailBodyDecode("\u003cii_jtobx3m60\u003e"),

Open in new window


decoding it with this function

function gmailBodyDecode($data) {
  $data = base64_decode(str_replace(array('-', '_'), array('+', '/'), $data)); 


  //$data = imap_qprint($data);
  return($data);
} 

Open in new window



it not doing anything, my application is took loading due to this.

any help ?
Avatar of Nicolas Lecanu
Nicolas Lecanu
Flag of Guadeloupe image

Hi Alex,

Can you give more details on what you want exaclty please ?

and if you want to decode json, you can use this simple function:

json_decode($data);

Open in new window

Avatar of Alex Lord
Alex Lord

ASKER

Hey

https://stackoverflow.com/questions/49629310/not-able-to-display-embedded-images-in-html-using-gmail-api-rails

i am following this example, i am trying to get the inline image displayed in the message from gmail api.
That is not base64 encoded - those are unicode charcaters
\u003c is a '<'
\u003e is a '>'

Decoded it looks like this

<ii_jtobx3m60>
You don't need to Base64 Decode that. Just run a json_decode on it:

$data = "\u003cii_jtobx3m60\u003e";
$string = json_decode('"' . $data . '"');

Open in new window

This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.