0

in PHP I have this code to convert a string to binary and encode to Base 64:

    <?php
$value = pack('H*', "b4h3h347h38f3g734ff");
echo base64_encode($value);

But how I can do that in Javascript ?

Thank you!

1
  • I found the solution thank you Commented May 21, 2017 at 14:25

1 Answer 1

0

See text_to_binary here in SO.

Use btoa() and atob() to convert to and from base64 encoding.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried that method but when I compare the result of PHP and Javascript, it is totally different
You have a similar way in javascript with the turbocommons library, easy and extensively tested: turboframework.org/en/app/stringutils/base64-encode

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.