A virtual teacher who reveals to you the great secrets of Base64

Implementing Unicode support for btoa() and atob()

By default JavaScript built-in functions btoa and atob do not support Unicode strings, because these functions treat all characters as 16-bit-encoded strings (that is, are accepted only characters from the extended ASCII table, up to 255 char code). Thus, trying to encode a multibyte character to Base64, the btoa function will throw exception “Character Out Of Range” or “Invalid Character Error”. On other hand, trying to decode a Base64 string that contains multibyte characters, the atob function will return some “weird” characters.

To bypass this limitation we should apply some hacks. For example, on the MDN portal are provided atou and utoa functions.

/**
 * ASCII to Unicode (decode Base64 to original data)
 * @param {string} b64
 * @return {string}
 */
function atou(b64) {
  return decodeURIComponent(escape(atob(b64)));
}
/**
 * Unicode to ASCII (encode data to Base64)
 * @param {string} data
 * @return {string}
 */
function utoa(data) {
  return btoa(unescape(encodeURIComponent(data)));
}

Let’s do some tests, to be sure that the functions above support Unicode strings:

// Both the “pi” and the “approximately equal” symbols are Unicode characters
// As you can see, btoa() fails to encode `str`, while utoa() works like a charm
var str = 'π ≈ 3.14159';
console.log(btoa(str)); //-> "InvalidCharacterError: String contains an invalid character"
console.log(utoa(str)); //-> "z4Ag4omIIDMuMTQxNTk="

// This is the Base64 value for `str` above (I encoded it using the https://base64.guru/converter)
// As you can see, atob() decodes it but return wrong result, while atou() does it properly
var b64 = 'z4Ag4omIIDMuMTQxNTk=';
console.log(atob(b64)); //-> "� � 3.14159"
console.log(atou(b64)); //-> "π ≈ 3.14159"

For more info, please check the MDN documentation: Base64 encoding and decoding.

Comments (16)

I hope you enjoy this discussion. In any case, I ask you to join it.

  • Mar,
    Hi!

    Thanks for your posts!

    I'm trying to decode a GIF to base64, using this utoa() function but it doesn't work. Can you tell me how should I do it?

    Thanks!
    • Administrator,
      Hello Mar,
      You do not need these polyfills to encode or decode binary data. In your case is more than enough to use the built-in functions btoa and atob. Also I recommend you to check these examples to learn how to use them for decoding and encoding binary data. If you still have questions, please do not forget to specify the error you are experiencing.
      • Mar,
        Hi! I found the error, thank you for your reply!
  • Juan,
    Hello,
    I'm trying to decode a PDF string to Base64. If I use your PDF to Base64 tool, the string generated is correct, and works fine. But if i try to manually do it, using the above utoa() function, with the same raw string, it doesn't product the same output.

    This is the raw PDF string:


    %PDF-1.5
    %âãÏÓ
    3 0 obj
    <</Filter/FlateDecode/Length 670>>stream
    xœ½XËrÓ0Ýû+î²]Ô‘l=ÙA3e€ŽaCYdl95$QqÜÎäï‘”¸¥!XJåÉ&Ééœs_º)g0œ™Ïr‘üNÞI΀rE•\É—$ƒ÷ö[‹CУ‹E2¹Â€urrZü´Øgˆ»ì¯CIT’”’§£™=Š %'ˆO˜d(Cö6³=7~ÿaþVNÑñq·jÚ©êM$ÊHŠYO“íÐܨúaY­"YxžÍå1B'òP:6h"§Ç²“1Õ]N»F/cM噏éí|=[lEø¸>·ú±©TëÊ>kª'‹5%±íë*Þ’¤!ž,St’¸i3àÂŒ¢èL ߌ¸jõ"Œ%°‰,Áéz¡–|TݝŽ´ûø\%¾àŒÍŸaÏMgº]GqˆË-k£Æ(T¯QÕB±¾®SéMäõ²œ?T
    ¾é¦ZÅ°€ˆF¯ÈGòIÚx(%T³”¥œnÀ©DRØË,Wf'ó™yG[•ÔCÒ„]N÷¡^ßSñ“ÔLb¶BíÉg¼Vã¹áè ;Æ‘;—u­Ê®yT»Ž„<Ž#œo2dÊ"(E>è¨_Æ“˜õqÄÌ+±_Æ“˜“­D$ÑÁ%Ú}Ä&D[y4¨p|8‚vÂŽ§±M_ñ y0$àúbÄÎß¡J0÷×àæYÜm{wpOÓov„ñì¼µq‡~wp~ϐD‡”C2?¹«Æn-í?;¼Ç”]8F4Ä)8‡öõÜž”wªüu{:âûèaˆÃ*-t7Ãˇ>TèÿW W­FkÎÙ`Tïuہ“ýïÆRÉ
    E>Øh38vÏ4~˜tÈòåÚ‚
    endstream
    endobj
    1 0 obj
    <</Tabs/S/Group<</S/Transparency/Type/Group/CS/DeviceRGB>>/Contents 3 0 R/Type/Page/Resources<</ColorSpace<</CS/DeviceRGB>>/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]/Font<</F1 2 0 R>>>>/Parent 4 0 R/Rotate 90/MediaBox[0 0 612 1160]>>
    endobj
    5 0 obj
    [1 0 R/XYZ 0 622 0]
    endobj
    2 0 obj
    <</Subtype/Type1/Type/Font/BaseFont/Helvetica/Encoding/WinAnsiEncoding>>
    endobj
    4 0 obj
    <</Kids[1 0 R]/Type/Pages/Count 1/ITXT(2.1.7)>>
    endobj
    6 0 obj
    <</Names[(JR_PAGE_ANCHOR_0_1) 5 0 R]>>
    endobj
    7 0 obj
    <</Dests 6 0 R>>
    endobj
    8 0 obj
    <</Names 7 0 R/Type/Catalog/Pages 4 0 R/ViewerPreferences<</PrintScaling/AppDefault>>>>
    endobj
    9 0 obj
    <</ModDate(D:20200708164215Z)/Creator(JasperReports Library version 6.8.1-3d4b87119c827be13776e451fb3738062f84a87d)/CreationDate(D:20200708164215Z)/Producer(iText 2.1.7 by 1T3XT)>>
    endobj
    xref
    0 10
    0000000000 65535 f 
    0000000752 00000 n 
    0000001039 00000 n 
    0000000015 00000 n 
    0000001127 00000 n 
    0000001004 00000 n 
    0000001190 00000 n 
    0000001244 00000 n 
    0000001276 00000 n 
    0000001379 00000 n 
    trailer
    <</Info 9 0 R/ID [<39d89610099bbd22e9da8b6197b5df31><8fc1d846a202c380f6def05390ccb937>]/Root 8 0 R/Size 10>>
    startxref
    1575
    %%EOF


    This is the output produced by your tool:

    JVBERi0xLjUKJeLjz9MKMyAwIG9iago8PC9GaWx0ZXIvRmxhdGVEZWNvZGUvTGVuZ3RoIDY3MD4+c3RyZWFtCnicvVjLctMwFN37K+6yXdSRbD3ZQR8zZYCBjmFDWWRsOTUkUXHczuTvkZS4pSFYSuXJJp3JHOmcc1+6KQIMZxgQMJyZz3KR/E7eFUnOgHIGRZVcFsmXJIP39luLQ9Cji0UyucKAERR1cnJa/LTYZ4i77K9DGEkEVJKUkqejmT2KHKCdJSeIT5CYZChD9jYEsz03fv9h/lZO0RAX8XGdt2raqepNJBMFykiKWU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q0Yjg3MTE5YzgyN2JlMTM3NzZlNDUxZmIzNzM4MDYyZjg0YTg3ZCkvQ3JlYXRpb25EYXRlKEQ6MjAyMDA3MDgxNjQyMTVaKS9Qcm9kdWNlcihpVGV4dCAyLjEuNyBieSAxVDNYVCk+PgplbmRvYmoKeHJlZgowIDEwCjAwMDAwMDAwMDAgNjU1MzUgZiAKMDAwMDAwMDc1MiAwMDAwMCBuIAowMDAwMDAxMDM5IDAwMDAwIG4gCjAwMDAwMDAwMTUgMDAwMDAgbiAKMDAwMDAwMTEyNyAwMDAwMCBuIAowMDAwMDAxMDA0IDAwMDAwIG4gCjAwMDAwMDExOTAgMDAwMDAgbiAKMDAwMDAwMTI0NCAwMDAwMCBuIAowMDAwMDAxMjc2IDAwMDAwIG4gCjAwMDAwMDEzNzkgMDAwMDAgbiAKdHJhaWxlcgo8PC9JbmZvIDkgMCBSL0lEIFs8MzlkODk2MTAwOTliYmQyMmU5ZGE4YjYxOTdiNWRmMzE+PDhmYzFkODQ2YTIwMmMzODBmNmRlZjA1MzkwY2NiOTM3Pl0vUm9vdCA4IDAgUi9TaXplIDEwPj4Kc3RhcnR4cmVmCjE1NzUKJSVFT0YK


    Do you know why they would be different?

    [UPDATED: ]
    I'm sorry, i seem to have miscopied the second base64. This is the output produced by utoa() function:

    JVBERi0xLjUKJcOiw6PDj8OTCjMgMCBvYmoKPDwvRmlsdGVyL0ZsYXRlRGVjb2RlL0xlbmd0aCA2NzA+PnN0cmVhbQp4xZPCvVjDi3LDkzAUw53DuyvDrsKyXcOU4oCYbD3DmUEfM2XigqzCgcW9YUNZZGw5NSRRccOcw47DpMOv4oCY4oCdwrjCpSFYSsOlw4kmwp3DiRzDqcWTc1/CuikCDGcYEDDFk+KEosOPcuKAmMO8TsOeFUnDjuKCrHIGReKAohbDieKAlCTGksO3w7Zb4oC5Q8OQwqPigLlFMsK5w4LigqwRFHVyclrDvMK0w5hny4bCu8Oswq9DGEkEVOKAmeKAneKAmcKnwqPihKI9xaAc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pb25EYXRlKEQ6MjAyMDA3MDgxNjQyMTVaKS9Qcm9kdWNlcihpVGV4dCAyLjEuNyBieSAxVDNYVCk+PiBlbmRvYmogeHJlZiAwIDEwIDAwMDAwMDAwMDAgNjU1MzUgZiAgMDAwMDAwMDc1MiAwMDAwMCBuICAwMDAwMDAxMDM5IDAwMDAwIG4gIDAwMDAwMDAwMTUgMDAwMDAgbiAgMDAwMDAwMTEyNyAwMDAwMCBuICAwMDAwMDAxMDA0IDAwMDAwIG4gIDAwMDAwMDExOTAgMDAwMDAgbiAgMDAwMDAwMTI0NCAwMDAwMCBuICAwMDAwMDAxMjc2IDAwMDAwIG4gIDAwMDAwMDEzNzkgMDAwMDAgbiAgdHJhaWxlciA8PC9JbmZvIDkgMCBSL0lEIFs8MzlkODk2MTAwOTliYmQyMmU5ZGE4YjYxOTdiNWRmMzE+PDhmYzFkODQ2YTIwMmMzODBmNmRlZjA1MzkwY2NiOTM3Pl0vUm9vdCA4IDAgUi9TaXplIDEwPj4gc3RhcnR4cmVmIDE1NzUgJSVFT0Y


    This also doesn't work. By "work", i mean that i cannot load this base64 as pdf in a browser window, while the base64 generated by uploading the same file into "https://base64.guru/converter/encode/pdf" does load into a browser window correctly.
    • Administrator,
      Hello Juan! Your mistake is that your are trying to copy "binary data" and paste it as "textual data". When copying like this, some characters are discarded and therefore you get different results.
      • Aline,
        Hi, I have the same problem of receiving strange characters, how could I convert?
  • nqhXncMU,
    -1' OR 2+761-761-1=0+0+0+1 --
  • nqhXncMU,
    TdsxJmFp' OR 883=(SELECT 883 FROM PG_SLEEP(15))--
  • nqhXncMU,
    (select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
  • nqhXncMU,
    1 waitfor delay '0:0:15' --
  • gBqsPxAZ,
    -5) OR 370=(SELECT 370 FROM PG_SLEEP(15))--
  • nqhXncMU,
    -1' OR 2+832-832-1=0+0+0+1 or 'FHZz7bYN'='
  • ncMUFCMU,
    -1; waitfor delay '0:0:15' --
  • ncMUFCMU,
    0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
  • ncMUFCMU,
    HCqiksND' OR 987=(SELECT 987 FROM PG_SLEEP(15))--
  • CG3000,
    0�20�ð L%6¤0*�H�80|10UUS10UCalifornia10USanta Clara10UWhatsApp Inc.10UEngineering10UBrian Acton0100625230716Z440215230716Z0|10UUS10UCalifornia10USanta Clara10UWhatsApp Inc.10UEngineering10UBrian Acton0�¸0�,*�H�80���ýS�u)R�J�.ìäçö·R<ïD�?�¶Q&iE]@"QûY=�Xú¿�õº0ö��Ul��;�4oòf`·k�P¥¤��è{"�O»©�þ·�ø;Wç�¨¦û�ö���5TZ�2öuó®+a
Add new comment

If you have any questions, remarks, need help, or just like this page, please feel free to let me know by leaving a comment using the form bellow.
I will be happy to read every comment and, if necessary, I will do my best to respond as quickly as possible. Of course, spammers are welcome only as readers.