Questions tagged [base64]

Base64 is a set of encoding schemes that represent binary data in an ASCII string format.

Base64 is a group of similar encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The Base64 term originates from a specific MIME content transfer encoding.

Base64 uses characters 0 to 9, A to Z and a to z to represent digits of 64-decimal numbers. The last two required digits differ between schemas. For instance, MIME (RFC 2045) uses + and / , XML names tokens use - and ., XML identifiers use _ and : and regular expressions use ! and -.

When encoding in Base64 text, 3 bytes are typically encoded into 4 characters. To encode arbitrary lengths, the padding character (=) is used. = at the end of encoded sequence means that only two bytes and == means that only one byte is encoded by the last 4 character group.

Characters outside the discussed alphabet are normally forbidden, except in MIME where they are discarded.

Base64 encoding schemes are commonly used when there is a need to encode binary data that need to be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remain intact without modification during transport. Base64 is commonly used in a number of applications including email via MIME, or to store binary data in textual formats such as XML or JSON.

Useful online tools

They work without enabled JavaScript too.

11149 questions
4
votes
1 answer

Reading a base64 image string with VBA?

QUESTION How to read or convert a base64 image string with Microsoft Access vba? REQUIREMENTS A base64 image string is stored in a ms sqlserver database as below: BASE64 data:image/png;base64,iVBORw0KGgoAAAA... Using vba I am attempting to read…
DreamTeK
  • 32,537
  • 27
  • 112
  • 171
4
votes
1 answer

Upload PDF as base64 file to the server using AJAX

Say I want to upload the following information to a server: var info = { name: "John", age: 30, resume: resume.pdf // base64 String }; My AJAX call might look something like this: $.ajax({ url: "http://example.com", type:…
Lior Elrom
  • 19,660
  • 16
  • 80
  • 92
4
votes
2 answers

JS: how to encode an image.png into base64 code for data URI embedding?

I have several .png bitmaps of different dimensions, by example ./img/dog.png and ./img/cat.png. How to load the base64 string of my images via JS ? My expected data is omething like that (but far longer): …
Hugolpz
  • 17,296
  • 26
  • 100
  • 187
4
votes
2 answers

how to upload base64 data as image to s3 using node js?

I am sending base64data of canvas to node.js script. I need the base64data to be stored as an image to the s3bucket. Is there any way to achieve it?
TeamA1
  • 193
  • 1
  • 3
  • 11
4
votes
2 answers

How to convert object which receives image in bytes into actual image?

I am developing smart device application in C#. In that I am calling the web services. The web service method return google map. The return type of the method is object. The object contains the image in byte format. The object conatins the image in…
Shailesh Jaiswal
  • 3,606
  • 13
  • 73
  • 124
4
votes
1 answer

Node.js - MJPEG TCP stream to base64 images

Based on paparazzo.js lib, I'm trying to get base64 images from a MJPEG stream (streamed over TCP with GStreamer) in a Node.js server, and to send them to the clients via websockets. I think I'm pretty close, but my images are corrupted. Here is the…
Tim Autin
  • 6,043
  • 5
  • 46
  • 76
4
votes
2 answers

Some utf-8 strings base64 encoded by php can not be decoded using iOS base64 library?

Here is one piece of Chinese utf-8 text which is encoded by PHP on the server-side, but when I decode it with iOS, it returns null. I also tried this online tool where text can be decoded well. NSData *decodedData = [[NSData alloc]…
sureone
  • 831
  • 2
  • 14
  • 25
4
votes
1 answer

Unexpected base 64 decode result in Clojure

I have required: [clojure.data.codec.base64 :as b64] I have defined a function: (defn toHexString [bytes] "Convert bytes to a String" (apply str (map #(format "%x" %) bytes))) I run this code to get a result in Clojure: (toHexString…
adrianmcli
  • 1,956
  • 3
  • 21
  • 49
4
votes
2 answers

UTF-8 error in GtkTextView while decoding base64

I have been trying to figure this out for a few days now. All I am trying to do is decode a base64 string and add it to a Gtk::TextView. Below is the code: txtbuffer_ = Gtk::TextBuffer::create(); txtview_.set_buffer(txtbuffer_); const Glib::ustring…
vis.15
  • 751
  • 8
  • 18
4
votes
1 answer

Java SHA1 hash to base64 : unsigned bytes?

I am trying to hash a value (SHA1) in both C# and Java, and then return a base64 representation. I get 2 different results. I know this is because Java uses signed bytes while C# doesn't. C# version : static public string toSHA1(string toEncrypt) { …
Yann39
  • 14,285
  • 11
  • 56
  • 84
4
votes
2 answers

Java equivalent of Convert.FromBase64String Method

Is there some Java equivalent of Convert.FromBase64String which Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array. I have tried: com.lutris.util.Convert. but it gives me…
Maksym Gontar
  • 22,765
  • 10
  • 78
  • 114
4
votes
2 answers

WPF - ImageSource for Window Icon from base 64 string (or byte array)

I'm in WPF and I'm using a WCF service to pull images as base 64 encoded strings. I convert the base 64 encoded strings to ImageSource to assign to Image.Source. I wrote a test app to test the process, and everything seemed to work fine as long as…
John
  • 163
  • 1
  • 9
4
votes
2 answers

Poco::Base64Decoder stream not returning complete string

not sure if i am just using it wrong because this is not really my field of expertise but i was under the impression that this should give me a complete decoded openframeworks buffer (or a simple string, i tried various ways all resulting in the…
DasAntonym
  • 452
  • 3
  • 19
4
votes
1 answer

C# and SQL Server disagree about whether a string is valid Base64 - which is correct?

We have the following table on a SQL Server 2008 R2 (SP1) database: -- irrelevant columns omitted create table Person ( PersonID int, Portrait varchar(max) ) The Person.Portrait column contains Base64 strings encoded from…
Ian Kemp
  • 28,293
  • 19
  • 112
  • 138
4
votes
2 answers

Null reference exceptions during Base64 deserialization (C#)

I am using the following methods to serialize and deserialize .NET objects: public static string SerializeToBase64(object data) { var stream = new MemoryStream(); var formatter = new BinaryFormatter(); formatter.Serialize(stream, data); …
Tim Coulter
  • 8,705
  • 11
  • 64
  • 95