Base64 to text js. Encode files to Base64 format.

from(await blob. js, as it is a built-in module in Node. mido. Below I provide a simple example which is supported by most popular browsers (Chrome 6+, Edge 12+, Firefox 3. How to encode JavaScript to Base64 Data. marksyzm. Let's see how you can encode a string by using the btoa () function: Dec 2, 2016 · var utf8encoded = Buffer. Mar 29, 2016 · I tried to use return reader. 7 base64. encode('Some string to encode to base64'); edited Nov 9, 2022 at 13:40. querySelector('audio'); // Play the audio. Base64 is particularly prevalent on the World Wide Web [1] where one of its uses is the ability to embed image files or other binary assets inside textual assets such as HTML and CSS files. Sep 30, 2020 · Web browsers provide a variety of data primitives that web developers use to manage, manipulate, and store data - from plain text, to files, images, videos and more. It is conceptually always a two step procedure: convert string to bytes (using some character encoding) encode bytes as Base64. How to decode Base64 Data to HyperText Markup Language (HTML) Input Base64 text; Press the button Decode (you will see the result in the field below Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand Feb 9, 2017 · var base64result = reader. result from the getBase64() function (rather than using console. However, you don't need to get a blob from node-fetch. It is important to remember that the size of Base64 encoded files increases by 33%. In this snippet, we’ll demonstrate how you can display Base64 images in HTML. Jun 14, 2024 · Base64. Jun 8, 2013 · I have a base64 string, file type. In addition, you will receive some basic information about this PDF (MIME type, extension, size). Let’s understand it with a Jun 4, 2015 · Base64 is a binary-to-text encoding, a sequence of bytes is encoded as a sequence of ASCII characters. Javascript provides a built-in function named btoa () (binary-to-ASCII) to perform Base64 encoding. let BASE64_MARKER = ';base64,'; let base64Index = dataURI. We cannot directly convert a base64 encoded string to a real object. js can be used to convert a string to a series of bytes. Using your data, this should do the trick: function convertURIToBinary(dataURI) {. The term Base64 originates from a specific MIME content transfer encoding. Input JavaScript content in the field; Press Encode button; Select output format (Plain Text, Data URL, HTML JavaScript tag); Copy or Download Base64 data; Done! Output Formats. audio. html) file or plain text. The btoa() method of the Window interface creates a Base64 -encoded ASCII string from a binary string (i. innerHTML; var dataURI = 'data:text/html,' + encodeURIComponent(html); If size matters, you'd better strip out all consecutive white-space (this can safely be done, unless the HTML contains a <pre Sep 26, 2016 · Learn how to use base64 encoding to load custom fonts in HTML and CSS, and see examples from Stack Overflow users. var image="data:image/png;base64, May 29, 2019 · The string is in hexadecimal format you will have to convert it. Convert image to Base64 online and use the result string as data URI, img src, CSS background-url, and others. For example: var jpegUrl = canvas. Apr 27, 2020 · Including upload an image using base64 in JavaScript. Base64 encoding tool supports loading the Base64 text File to transform to Image. About Encode Text To Base64 Tool. As with all binary-to-text encoding schemes, Base64 is designed to carry data stored in binary formats across channels that only reliably support text content. 6+, Internet Explorer 10+, Safari 6+). 8k 15 97 119. Base64 to String allows loading the Base64 URL converting to Text. How can I save base64 string as file on browser? Oct 17, 2023 · The core functions to base64 encode and decode in JavaScript are btoa() and atob() . pdf', pdfBuffer,{encoding:"binary Alternatively, you can use JavaScript’s built-in btoa() and atob() functions for Base64 encoding and decoding respectively: var encodedData = window. This encoding can be sp The canvas element provides a toDataURL method which returns a data: URL that includes the base64-encoded image data in a given format. 0. btoa(markup); Or if you get UTF8, use this, var encoded = window. txt', function(err, data){console. I think you have missed the return statement in the code. Buffers can be used for taking a string or piece of data and doing Base64 encoding of the result. I know this question is old, but also wanted to accomplish this and came across it while looking. result. You can use the Window. Both atob() and btoa() work on strings. Encode each line separately (useful for when you have multiple This page provides a Javascript implementation online Base64 encoder and decoder that can be used to convert Text and Binary Data to Base64 format. Convert a PNG file using Base64: This can be done in a similar The encoded text will appear on the right side; If you select the decode base64 to text option, it will allow you to convert any base64 string into a human readable string. To create a blob from the base64 string there were many results on this site, so its not my code I just can't remember the specific source: May 12, 2010 · Here is how you encode normal text to base64 in Node. Another solution is to find the index of the comma and then simply cut off everything before and including the comma: Feb 11, 2012 · If you don't mind the size of the data-URI, the easiest method to do so is using encodeURIComponent: var html = document. The Base64 string contains just the binary content of a pdf file in encoded form. Latest version: 1. This browser-based utility converts Unicode data to base64. Jun 22, 2017 · Well. Dec 1, 2023 · Alternative Method: Using the Buffer Object. Start using base-64 in your project by running `npm i base-64`. Convert your text or string to Base64 format effortlessly with our Encode Text To Base64 tool, one of our Converters family. This conversion is particularly useful for various applications: Jun 29, 2019 · I'm new to JS so i'm gonna try to explain the prob. Feb 2, 2024 · The following are additional binary-to-text encodings that Node. play(); This code uses the querySelector method to get the audio element, and then calls the play method to play the audio. Aug 17, 2019 · I would create a function that converts the URI to pure binary by removing the base64 headers, and then setting that as the audio source. I tried putting them in a txt file and doing: fs. Sometimes you have to send or output an image within a text document (for example, HTML, CSS, JSON, XML), but you cannot do this because binary characters will damage the syntax of the text document. But the generated File is broken and I cant open it with Adobe Reader. createObjectURL(blob); Oct 17, 2012 · Now available on Stack Overflow for Teams! AI features where you work: search, IDE, and chat. Decoding Base64 Strings with Node. It’s a simple procedure in which the btoa() method takes binary data as input and returns a Base64 Jan 8, 2019 · For NodeJS (with node-fetch), you can get a buffer from blob using Buffer. toDataURL("image/jpeg"); var pngUrl = canvas. When a download request is made to the server I get the same data back but I'm having a difficulty downloading the file. Click on the Upload File button and select File. net/XTUmV/28/ but it doesnt show anything. Base64 encoding is used to represent binary data, such as video files, in a textual format consisting of ASCII characters. var audio = document. Add that encoded result to an url and open that url on submit. log(Buffer. Base64 encoding schemes are commonly used when there is a need to encode binary data, especially This tool allows loading the Base64 URL converting to Hex. When I pass a file to the input element and read it with FileReader(), I get a base64 encoded string. For example, if you have a string stored in a variable, as seen below, you can first encode it to Base64: Apr 14, 2023 · Favorite (0) A base64 encoded string is just a representation of binary data as ASCII text. After converting image, you can download this as png file / picture. Since version 3. atob( encodedData); // Decode. Another way to encode a string to Base64 in JavaScript is by using the Buffer object. 3 it is written in TypeScript. toDataURL(); // PNG is the default. 0, last published: 4 years ago. This tool supports loading the Base64 File to transform to Text. File type can be image, text or even pdf. , and you could base-64 server side, if necessary for your database. If you want to decode, use Base64 to JavaScript Decoder. This method takes two parameters, a plain-text string, and the character encoding, and creates a buffer or binary data array for the given encoding. Just copy your encoded string on the left side, click on the arrow and you will have the decoded text on the right side. onload = function (evt) {. Hope it help to you! Usage: input is your nameId input has file image Feb 13, 2019 · 4. You can just get a buffer directly from the response. Dec 18, 2023 · Approach. i am trying http://jsfiddle. You can then use an online Base64 encoder to convert it into a Base64 string. A robust base64 encoder/decoder that is fully compatible with `atob()` and `btoa()`, written in JavaScript. answered Feb 13, 2019 at 7:56. // Uma string qualquer var string = 'DevPleno' // Convertendo para Base64 var emBase64 = btoa( string) console. May 27, 2011 · Once started on the folder that contains the picture to transform, open the url in browser and using developer console you can convert the image to base 64. from(base64String, 'base64'); fs. from() method that accepts the string to be converted and the current encoding of the string. Feb 26, 2019 · btoa(data) - Converts data to STRING and encodes it to Base64; Arguments: data (required string) - Text or binary content that you want to encode; Return Values: STRING - On success, it returns the Base64 value, typically longer by about 33% than data; Exceptions: On failure the function may throw one of the following exceptions: . // Define the FileReader which is able to read the contents of Blob var reader = new FileReader(); Base64 Encoding in JavaScript using btoa() Function. ts then base64. If you want to encode HTML text, use HTML to Base64 Encoder. Replace your function with the following lines: var filereader = new FileReader(); filereader. You then add the base64 string into your html. The fact is that if you do not convert binary to Base64, you won’t be able to insert such data into text files, because binary characters will corrupt text data. Aug 4, 2020 · 3. documentElement. – Feb 8, 2023 · You can encode a string to base64 in JavaScript using the btoa () function and decode a base64 string using atob () function. Concisely, server sends me file as base64 string, and I need to save it as file on browser. Say goodbye to manual encoding and hello to efficiency. This tool helps to convert base64 string / text to image. open(""); Base64 encoding and Data URL go hand-in-hand, as Data URLs reduce the number of HTTP requests that are needed for the browser to display an HTML document. pdf; const pdfBuffer = Buffer. Base64 encode your data without hassles or decode it into a human-readable format. target. Why are you base-64 encoding between browser and server, and trying to accomplish this in the browser? Seems like if your trying to secure the data, SSL would be much easier as it encrypts all of the HTTP data (including files) over the wire. This happens fully in your browser using JavaScript , no content will be sent to any kind of server. log(reader. Let's see in action with an example: Jul 18, 2013 · Function convert image to base64 using jquery (you can convert to vanila js). btoa('B64Encode'); // Encode var decodedData = window. Jun 22, 2017 at 8:13. Brief History. Sep 10, 2019 · Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers; Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand A Video to Base64 Converter is a tool designed to encode video files into Base64-encoded text format. The following shows a quick example: // A really plain string that is just code points below 128. It supports the most popular Unicode encodings (such as UTF-8, UTF-16, UCS-2, UTF-32, and UCS-4) and it works with emoji characters. answered May 29, 2019 at 14:06. Here's what worked as of January 2019: yarn add react-native-base64. Therefore, if you are not sure that your Base64 string is an image, use the Base64 to file converter since it is capable of displaying various file types. Conversely, the btoa() function creates a base-64 encoded ASCII string from a "string" of binary data. If omitted, defaults to text/plain;charset=US-ASCII. readAsDataURL(file); filereader. Meet Base64 Decode and Encode, a simple online tool that does exactly what it says: decodes from Base64 encoding as well as encodes into it quickly and easily. FYI, I just read a study that base 64 actually loads slower on mobile so if your app is heavy mobile I'd stay away To encode a Blob object to Base64 in JavaScript you can use the FileReader. In this tutorial, you will learn how to encode a string to Base64 encoded format. By and large, the “Base64 to JPG” converter is similar to Base64 to Image, except that it this one forces the MIME type to be “image/jpeg”. Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by transforming it into a radix-64 representation. from("SGVsbG8gV29ybGQ=", 'base64'). Otherwise, if you have a Base64 string, paste it into the “Base64” field and press “Decode JavaScript String Base64 is a group of binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. JavaScript includes a method called btoa(), which stands for “binary to ASCII“. And, of course, you will have a special link to download the PDF to your device. I'm looking for a JS to perform some tasks like: input text form to include certain "text" in a base64 decoded string and then encode that string. then. Jan 30, 2024 · To play the audio using JavaScript, we can use the following code: // Get the audio element. May 1, 2018 · Therefore, I need some help converting my XML Doc variable into Base64 (instead of my XML string) using Javascript. edited May 29, 2019 at 14:12. Decoding a Base64 string is quite similar to encoding it. Base64 to Text Online works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari. Approach: Canvas (for legacy browsers) Load the image into an Image-Object, paint it to a nontainted canvas and convert the canvas back to a dataURL. Newline separator (for the "encode each line separately" and "split lines into chunks" functions). toString('ascii')) Hello World The Buffer constructor is a global object, so no require is needed World's Simplest Unicode Tool. , a string in which each character in the string is treated as a byte of binary data). Mar 6, 2024 · The TextDecoder interface represents a decoder for a specific text encoding, such as UTF-8, ISO-8859-2, KOI8-R, GBK, etc. 24. When the term "Base64" is used on its own to refer to a specific algorithm, it typically refers to The same rule applies to the opposite direction. Whitespace in the base64-encoded string, including spaces, tabs, and newlines. I need to show download link and when user clicks it should start downloading as expected file. js supports. Apr 7, 2020 · To convert a string into a Base64 encoded string, we first create a buffer from the given string using the Buffer. Select a file to upload and process, then you can download the encoded result. What am I doing wrong? This is my Code from server Side: let data = req. This method is especially useful when working with Node. I will not post the code, since its already explained Decode Base64 to Hexadecimal string with javascript. Example 1: Encode a String to Base64 Using btoa() Here are some examples of converting Javascript Base64 to image: Convert a JPG file using Base64: To do this, you will need to make sure that the JPG file is in a text-based format first (likely in UTF-8). Example: var base64Value = "oAAABTUAAg==" Need conversion method Output (Decoded data (hexadecimal)) A0000005350002 I Learn how to decode a Base64 encoded data back to normal text in Javascript. First you convert the string to binary (atob > charCodeAt) and then using the toString (16) you get the hex. . btoa() goes from a string to a base64-encoded string, and atob() decodes back. One such example is converting a base64 string to a blob using JavaScript. Base64 encoding schemes are commonly used when there is a need to encode binary data that needs to be stored and transferred over media that are designed to deal with textual data. Plain Text - Only Base64 data; 2 days ago · Data URLs are composed of four parts: a prefix ( data: ), a MIME type indicating the type of data, an optional base64 token if non-textual, and the data itself: data:[<mediatype>][;base64],<data>. If you need to encode a text to Base64, fill in the “Text” field and press “Encode text to Base64” — the result will appear in the “Base64” field. You can get you Markup as a string with, var markup = document. Nov 13, 2017 · Neither the accepted answer nor the Buffer methods worked for me. com" converted to Base64 is "c3RhY2thYnVzZS5jb20=" In the output we can see the Base64 counterpart for the string that we converted to Base64. 3 X 8 Aug 29, 2016 · So what you need to do is: Recover the Blob Object that is used to create the Blob URL. This only works if base64encoded is a string. The btoa function takes a string of binary data and converts it into a Base64-encoded ASCII string. The maximum file size is 192MB. To use Base64 effectively in your JavaScript projects, here are some helpful tips and best practices to keep in mind: Check Browser Compatibility Jun 3, 2024 · Window: btoa () method. These characters include uppercase letters (A-Z), lowercase letters (a-z), digits (0-9), and two special characters (+ and /). Convert Base64 to JPG online using a free decoding tool that allows you to decode Base64 as JPG image and preview it directly in the browser. This tool allows loading the Base64 URL converting to HTML. result)) because i want to capture the base64 as a variable (and then send it to Google Apps Script). base64; base64url; hex; The Base64 encoding accepts the URL and Filename Safe Alphabet described in RFC 4648 Section 5 when constructing a buffer from a string. Javascript has a built-in function named atob() which performs Base64 decoding. If you need more features and better customization for encoding text to Base64, please use the Base64 encoder . Here we will create a gfg. If you are looking for the reverse process, check JPG to Sep 5, 2023 · Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. May 28, 2024 · Base64 encoding and decoding can be done in Node. You can also use it to ensure your text or information does not get corrupted during a transfer. atob Interesting. js is ES5-compatible again (hence IE11-compatible). Jul 12, 2023 · $ node encode-text. toUint8Array(pngBase64). Only thing I've found is to dump the already-encoded buffer to a base64, read it back into the Mar 11, 2016 · I had a very similar requirement (importing a base64 encoded image from an external xml import file. The mediatype is a MIME type string, such as 'image/jpeg' for a JPEG image file. No magic. indexOf(BASE64_MARKER) + BASE64_MARKER. Jun 3, 2023 · Base64 encoding is a technique to convert binary data into ASCII text format, which consists of a set of 64 different characters (hence the name "Base64"). Although the return value is not just the base64 encoded binary data, it's a simple matter to Nov 30, 2019 · Base64 encoding and decoding in JavaScript. However, using them correctly and effectively can be confusing. Whether you’re encoding URLs, CSS, HTML, XML, JavaScript, or any other text-based content, our tool simplifies the process. var base64 = ("yourBase64StringVariable") const blob = base64ToBlob( base64, 'application/pdf' ); const url = URL. About. However, the atob() function doesn't work properly if the encoded data contains DOMStrings which are 16-bit encoded. In this article, we have explored a simple approach to Convert Base64 to PDF online using a free decoding tool which allows you to decode Base64 as PDF and display it directly in the browser. See also here. split(',')[1]; This splits the string into an array of strings with the first item (index 0) containing data:image/png;base64 and the second item (index 1) containing the base64 encoded data. In this article, we will delve into the essence of Base64 in the context of jQuery, and show how it can be Nov 18, 2015 · Base-64 makes the file larger, but it makes it more machine readable so it actually increases pagespeed. So when there is an emoji in the string, I get this error: Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range. cryptii v2. Apr 10, 2019 · The “Base64 to Image” converter will force the decoding result to be displayed as an image, even if it is a different file type. Encode files to Base64 format. readFile('image. – I haz kode. js using the Buffer object. html file. js. the base64 decode string is something like: Utilizando Base64 no navegador (Internet Explorer 10 e acima): O código abaixo pode ser copiado e colado dentro do Console do Chrome, para vê-lo executando. Use readAsDataURL to convert the recovered Blob Object to base64 url. arrayBuffer());. btoa() method to encode and transmit data which may otherwise cause communication problems, then transmit it and use the atob() method to decode the data again. and group every 3 characters of input, e. toString('utf8'); answered Dec 2, 2016 at 9:56. Base64 allows you to embed a wide variety of binary data directly into text-based documents and code. Click on the Upload button and select File. js "stackabuse. length; How to Encode and Decode Strings with Base64 in JavaScript. This tool supports loading the Base64 File to transform to HTML. Nov 19, 2013 · i am new to javascript. However, we can decode the base64 encoded string to get the binary data, and then use appropriate techniques to convert that data to a real object. The converter helps to decode Base64 text and download the result data as an HTML (HyperText Markup Language, . Jun 18, 2019 · I've been trying to encode a twitter embed code into base64 that may or may not contain one or multiple emojis. 5,525 2 30 27. js is generated from base64. writeFile('output. readAsDataURL() method. A decoder takes a stream of bytes as input and emits a stream of code points. You have to create a new buffer object and pass two parameters to its Feb 28, 2022 · the problem is that the base64 strings are huge, and for some reason I cant store them in my component. This tool helps you to convert your Base64 String to image with Ease. Nov 18, 2016 · The fix is to convert the base64 back into Binary, pack it inside of a Blob, and then set the iframe's "src" to a Blob-URI pointing to that blob. 2. Base64 to HTML Online works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari. Tips for Proper Base64 Encoding and Decoding in JavaScript. 1 It is therefore not possible to directly encode text as Base64. from("Hello World"). result; return base64. I have done the Aug 11, 2023 · In JavaScript, there are two built-in functions that can be used to encode and decode Base64 strings: btoa and atob. from(base64encoded, 'base64'). from() method. innerHTML; And then convert that string to base64 using btoa() like this, var encoded = window. The Base64 Encode Technique is often used to make binary data (those non-printable) into text-printable characters. mjs. g. You have to encode the "value" into base64 first via an external method. com Do you have a Base64 string and do not know how to convert it to PDF using JavaScript? Do not worry! I am here to help you. I receive the same base64 encoded string in the response from the server but unable to open the downloaded file. In addition, I’ll show how to embed PDF into HTML page and create a link to download the PDF. Destination character set for text files. If no character encoding is specified, UTF-8 will be used as the Use this Base64 to Text converter tool by pasting or uploading Base64 in the left box below. It uses a 64 character table. guru will probably do more or less the same as in the linked SO question. Now we will put onchange on the input type and this will execute a function imageUploaded () when you upload an image. If it's already a buffer you get the same encoded value out as what went in. See full list on linode. After using xml2json-light library to convert to a json object, I was able to leverage insight from cuixiping's answer above to convert the incoming b64 encoded image to a file object. In any case, feel free to give it a try, since this Encode file to Base64 online and embed it into any text document such as HTML, JSON, or XML. js file which will include JavaScript code and one gfg. const asciiString = 'hello'; // This will work. i want to create SVG from base64. – The Base64 online converter supports both functions of the algorithm on same page. toString('base64')); SGVsbG8gV29ybGQ= > console. This can be done using the Buffer. base64. The principle is always the same, try to see if the data contains a file header and compare to known types. btoa(unescape(encodeURIComponent(markup))); edited Feb 13, 2019 at 9:02. Decode your Base64 data into a text string. parseFromString(xmlDataString,"text/xml"); Does anyone know a function besides btoa() which is used for converting strings? Feb 14, 2023 · 1. e. Base64 is basically a way to encode information and it's typically used when you want to send binary data over a text-based protocol such as HTTP. Here is the code I find in this answer : var blob = new Blob(["Hello, world!"], { type: 'text/plain' }); var blobUrl = URL. log( emBase64) // Saída: "RGV2UGxlbm8=" // Voltando para string var May 2, 2022 · base64. Now we will use a file reader and use the onload event in the file reader then we will get the image URL and we need to May 4, 2017 · In JavaScript there are two functions respectively for decoding and encoding base64 strings: atob() btoa() The atob() function decodes a string of data which has been encoded using base-64 encoding. Now base64. Or even better, Base64. var parser = new DOMParser(); var xmlDoc = parser. For example, you can submit an HTML form using Sep 13, 2016 · Needing to convert a Base64 string to Hexadecimal with javascript. Please note that the encryption methods offered below are very basic and therefore not Jun 3, 2024 · The atob() method of the Window interface decodes a string of data which has been encoded using Base64 encoding. Results will appear in the box on the right. Base64 to Hex Online works well on Windows, MAC, Linux, Chrome, Firefox, Edge, and Safari. So that I can implement a live preview for uploadable HTML files, I need help decoding the base64 string. There are 1700 other projects in the npm registry using base-64. I can definitely see why you'd want this, unless you want to look at 50 lines of gibberish in your file. Anything that you paste or enter in the text area on the left automatically gets encoded to base64 on the right. log(data);}) Jan 20, 2021 · This is fine as when I decode 'JVBERi0xLj' I get the correct text in case of a text file. For internet explorer I used code from here to save a Blob. I will show you some practical examples how to decode Base64 to PDF using the atob function and get some information about it. For example, you can encode, transmit, and decode control characters such as ASCII values 0 through 31. This tool supports loading the Base64 File to transform to Hex. This is to ensure that the data remain intact without modification during transport. For example: > console. I´m trying to decode a Base64 String to a PDF. What do I have to do to convert it to HTML/TXT? I already found some stuff about decoding pictures, which unfortunately didn't help me. mjs is compiled from base64. createObjectURL( blob ); const pdfWindow = window. cryptii is an OpenSource web application under the MIT license where you can encode and decode between different format systems. You can use this method to encode data which may otherwise cause communication problems, transmit it, then use the Window. Learn more Explore Teams Feb 8, 2019 · The “Text to Base64” converter is a simple encoder tool that allows you to convert online text to Base64 (that is, it encodes any textual characters into a basic ASCII string). body; const base64String = data. In JavaScript Base64 is mainly used to encode and decode strings, especially when that data needs to be stored and transferred over media that are designed to deal with text. Encoding the original string to base64: The Buffer class in Node. js: //Buffer() requires a number, array or string as the first parameter, and an optional encoding type as the second parameter. The atob function does the opposite, taking a Base64-encoded string and converting it back into binary data. This method makes it simple to encode binary data into Base64 format, such as strings or binary files. Click on the URL button, Enter URL and Submit. getElementById("html"). cryptii. var base64 = evt. This article also shows how to handle UTF-16 strings. import base64 from 'react-native-base64'. dq zb lr zl db le sj xl hh wj