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
2 answers

How to base64 encode apache header?

I'm using apache as a frontend http proxy. I need to send a header with a value from a specific environment variable to all proxied request. Like this: RequestHeader set myheader %{FOO}e The issue is that the value from the env variable FOO must be…
Martin Wickman
  • 19,662
  • 12
  • 82
  • 106
4
votes
2 answers

Restrictions on characters in POST variable names

I was recently surprised to learn that PHP will automagically and unpreventably turn all periods to underscores in the names of POST fields, because periods are not allowed in variable names in PHP. I have POST data that is keyed with names that…
uk4321
  • 1,028
  • 8
  • 18
4
votes
0 answers

EXIF data from image using javascript and phonegap to fix orientation

I am using phonegap and javascript to capture an image and display the image. The orientation is wrong when displayed on my android device. Having done some research I came across two JS files binaryajax.js and exif.js. I am trying to use this to…
Jed I
  • 998
  • 3
  • 19
  • 37
4
votes
0 answers

divide base64 encoded string into small chunks

i am trying to send a base64 encoded data to server but at a time i can send 65535 bytes of data to server and my string size of base64 encoded image is 111751 bytes. so how can i divide the content of base64 encoded string into small piece of 65535…
Hunt
  • 8,215
  • 28
  • 116
  • 256
4
votes
1 answer

Create SVG from base64 in javascript

i am new to javascript. i want to create SVG from base64. i am trying http://jsfiddle.net/XTUmV/28/ but it doesnt show anything. var…
user2224342
  • 75
  • 2
  • 4
4
votes
1 answer

Titanium save files from stream

I have a streamer from server(SOAP) with different type of files, and i what seve it in physical storage. I try this code but i only create file with my string. api.getFile(function(fileString) { var original = 'Appcelerator'; var…
jay
  • 1,453
  • 1
  • 11
  • 30
4
votes
2 answers

Strange IOError when opening base64 string in PIL

I tried encoding an image and decoding the same in python shell. The first time I open the decoded base64 string in PIL there is no error, if I repeat the Image.open() command I'm getting IOError: cannot identify image file. >>> with…
Praveen
  • 2,400
  • 3
  • 23
  • 30
4
votes
2 answers

Displaying base64 encoded image in rails

Update: I took the base64 string iOS was generating and decoded it to a binary file through a website. The image was encoded properly it seems. My problem then is with the rails side of things. I'm displaying the image using the following code but…
user470763
4
votes
1 answer

How do I convert a base64-encoded file using perl?

What methods are available to translate a base64-encoded file using Perl? I want to view and edit the file. $ file base64result base64result: XML document $ls -l base64result -rw-r--r-- 1 dpadmin appadmin 52K Oct 28 12:57…
letakeda
  • 155
  • 3
  • 12
4
votes
3 answers

Reinterpret float vector as unsigned char array and back

I've searched and searched stackoverflow for the answer, but have not found what I needed. I have a routine that takes an unsigned char array as a parameter in order to encode it as Base64. I would like to encode an STL float vector (vector) in…
Raymond
  • 105
  • 1
  • 2
  • 10
4
votes
0 answers

Getting favicon to work in Chrome with base64 data

I have searched the half of the day for this. It seems that its really easy for people to make it working.. But I have some problems getting Chrome to understand it. Its works in FF. I have the icon in png format located in root. Any ideas? I'm…
JW_
  • 652
  • 1
  • 8
  • 22
4
votes
1 answer

Why does conversion from two different base64 strings return equal arrays of bytes?

I am wondering why conversion from base64 strings returns equal byte arrays for different strings? const string s1 = "dg=="; const string s2 = "dq=="; byte[] a1 = Convert.FromBase64String(s1); byte[] a2 =…
Qué Padre
  • 2,005
  • 3
  • 24
  • 39
4
votes
3 answers

Secure communication between arduino and PHP using RC4 and base64

I'm trying to make a mildly secure communication between Arduino and PHP. I can not use SSL for lack of power on the Arduino. So I wanted to use RC4 to encrypt data from PHP, and receive into the Arduino and decrypt. also encrypt from the Arduino…
Michael Paleo
  • 111
  • 3
  • 6
4
votes
2 answers

dataurl to image for download in php

I'm creating image using canvas and using following script, function getImage() { var canvas1 = document.getElementById("images"); if (canvas1.getContext) { var ctx = canvas1.getContext("2d"); var myImage =…
KarSho
  • 5,699
  • 13
  • 45
  • 78
4
votes
3 answers

What is the best method to determine if a value is either a base64 string or an image URL?

I have a value that may be either an image URL or an image Base64 string. What is the best method to determine which is which? If it's an image URL, the image will already reside on my server. I've tried doing a preg_match but I think running a…
ditto
  • 5,917
  • 10
  • 51
  • 88
1 2 3
99
100