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

Can I add a base64 image to the $_FILES array?

Is there a way to add a base64 image string to the $_FILES array (the array that you get when you upload a file)? Basically, I want to fake a file upload from a base64 string. The base64 string comes from an email attachment. I don’t wish to use…
Marais Rossouw
  • 937
  • 1
  • 10
  • 29
4
votes
1 answer

When using HTTP, which encoding is better, base64, yEnc, or uuencode?

My requirement is to encode data and send it across network via HTTP, but I am stuck trying to choose the best encoding technique. Which of the three above is best? Is there anything better? The criteria for "best" should be small size and fast…
Charzhard
  • 783
  • 1
  • 7
  • 19
4
votes
2 answers

how to convert base 64 string to image embedded in html

I am getting the base 64 string in my email but i need to make it is visible as an image to the users. The image will not be static for all the users
user2477454
  • 41
  • 1
  • 3
4
votes
1 answer

Convert.FromBase64String(...) throws a FormatException

The following line of code runs fine in IIS Express: Convert.FromBase64String("dmVoaWNsZUlkPTE0MTM=??"); But when run on my local IIS 8 server, it throws the following exception: System.FormatException: The input is not a valid Base-64 string as…
Dave New
  • 38,496
  • 59
  • 215
  • 394
4
votes
1 answer

Generate all base26 triplests in the fastest way

I need to generate a list of triplets containing only uppercase English letters: ["AAA","AAB","AAC", ..., 'ZZZ'] What is the fastest way to do this in python?
mnowotka
  • 16,430
  • 18
  • 88
  • 134
4
votes
1 answer

How to decode base64 and turn it back into an image in perl

I have a variable $photo (huge string that has been base64 encoded) that I believe I need to decode it using MIME::Base64 with something like this: my $decoded= MIME::Base64::decode_base64($photo); now after that how to I make $decoded back into a…
BluGeni
  • 3,378
  • 8
  • 36
  • 64
4
votes
0 answers

ASP.NET WebAPI - How do I receive Base64 encoded binary from JSON post?

I want to send a BLOB to my API. I've got a model with two properties: Id (int), Blob (byte[])... How is this received by the WebAPI controller? Will it recognize the model and convert the Base64 encoded BLOB from the JSON into a byte[]? Currently…
iLoch
  • 741
  • 3
  • 11
  • 32
4
votes
1 answer

Screenshot of a div with html2canvas. Sent to php, saved: Corrupted image

I generate the canvas and pass it to php so: $('body').on('click','#save_image',function(){ html2canvas($('.myImage'), { onrendered: function(canvas) { //$('.imageHolder').html(canvas); …
Toni Michel Caubet
  • 19,333
  • 56
  • 202
  • 378
4
votes
1 answer

Decode Base64 into UTF-8 rather then single byte encoded text

Here are things that I've tried: Added annotation to the buffer: #-*- coding: utf-8; -*- M-x M-m c, select utf-8 from the list, then M-xbase64-decode-region. Here's what the buffer shows: \327\252\327\234 \327\220\327\221\327\231\327\221. What it…
user797257
4
votes
4 answers

Given a string, how do I know if it needs decoding

I'm using python's base64 module and I get a string that can be encoded or not encoded. I would like to do something like: if isEncoded(s): output = base64.decodestring(s) else: output = s ideas?
Guy
  • 14,178
  • 27
  • 67
  • 88
4
votes
1 answer

Working with extra large json files. Return always out of memory

How to use the stream API json with jackson? See my code below: ObjectMapper mapper = new ObjectMapper(); Map map = new HashMap(); List list = new ArrayList(); // Get images in…
Schlacter James
  • 147
  • 1
  • 3
  • 9
4
votes
2 answers

Why does this code have 3 octets over 4 characters?

I'm trying to understand this JavaScript base64 decoding code but I'm puzzled by this loop at lines 70-84: for (i=0; i
cdmckay
  • 31,832
  • 25
  • 83
  • 114
4
votes
3 answers

How to encode base64 in Delphi 6?

I need to encode a pdf document to base64 in Delphi6. Can anyone help me?
user1984193
  • 41
  • 1
  • 1
  • 4
4
votes
1 answer

coding favicon in base64

hello i'm writing a GM user script and i want to change the favicon dynamically changing it the old way is easy but i want to encode it in base64 to avoid hosting it this is what i have done after hosting the favicon var link =…
unloco
  • 6,928
  • 2
  • 47
  • 58
4
votes
4 answers

Haskell map (?) operation with different first and last functions

I am writing a Haskell function that operates on a list of ByteString values. I need to do a different operation on the first and last items (which may be the same if the list has only one item). Specifically, I want to write out the following: …
Ralph
  • 31,584
  • 38
  • 145
  • 282
1 2 3
99
100