ninjatronic / angular-base64

Base64 conversion for AngularJS
Other
185 stars 113 forks source link

base64 Encode with smileys... #8

Closed vsandoria closed 9 years ago

vsandoria commented 9 years ago

iOS native smileys not working with encode/decode function.

I am working on chat application with Ionic Framework, encryption / description works fine with text & symbols but fails with smileys. sample text: "Hey there, this is sample text with smileys 😣😣😣😌" Thanks

ninjatronic commented 9 years ago

Please read this note on encoding and decoding unicode strings.

So, you could use something like:

var encoded = $base64.encode(unescape(encodeURIComponent("Hey there, this is sample text with smileys 😣😣😣😌")));

See the README for a full example.

vsandoria commented 9 years ago

Thanks Pate,

This works for me, Please let me know to decode the same string, I tried to use

$base64.decode(unescape(decodeURIComponent( $encodedVariable )));

On Mon, Mar 9, 2015 at 7:14 PM, Pete Martin notifications@github.com wrote:

Please read this note on encoding and decoding unicode strings https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding#The_.22Unicode_Problem.22 .

So, you could use something like:

var encoded = $base64.encode(unescape(encodeURIComponent("Hey there, this is sample text with smileys [image: 😣][image: 😣][image: 😣][image: 😌]")));

— Reply to this email directly or view it on GitHub https://github.com/ninjatronic/angular-base64/issues/8#issuecomment-77855126 .

----------*----------- This email and any attachments are confidential and intended only for the individual(s) named. If you are not the named addressee or have received this email by mistake, please (a) notify the sender, and (b) delete this email immediately without distributing or retaining. The sender does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.

Any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the organization. Our employees, contractors & students are expressly required not to infringe on copyright or any other law. Any such communication is contrary to company policy and outside the scope of his/her engagement with the company. iLEAD, Crinis or Synapse will not accept any liability in respect of such communication, and he/she will be personally responsible and liable for any damages.

ninjatronic commented 9 years ago

The wisdom you seek...

var decoded = decodeURIComponent(escape($base64.decode( encoded )));