Write Base64-encoded image to file

Assuming the image data is already in the format you want, you don’t need ImageIO at all – you just need to write the data to the file: // Note preferred way of declaring an array variable byte[] data = Base64.decodeBase64(crntImage); try (OutputStream stream = new FileOutputStream(“c:/decode/abc.bmp”)) { stream.write(data); } (I’m assuming you’re using Java … Read more

A plain JavaScript way to decode HTML entities, works on both browsers and Node

There are many similar questions and useful answers in stackoverflow but I can’t find a way works both on browsers and Node.js. So I’d like to share my opinion. For html codes like   < > ' and even Chinese characters. I suggest to use this function. (Inspired by some other answers) function decodeEntities(encodedString) { … Read more

A plain JavaScript way to decode HTML entities, works on both browsers and Node

There are many similar questions and useful answers in stackoverflow but I can’t find a way works both on browsers and Node.js. So I’d like to share my opinion. For html codes like   < > ' and even Chinese characters. I suggest to use this function. (Inspired by some other answers) function decodeEntities(encodedString) { … Read more

How to decode a QR-code image in (preferably pure) Python?

You can try the following steps and code using qrtools: Create a qrcode file, if not already existing I used pyqrcode for doing this, which can be installed using pip install pyqrcode And then use the code: >>> import pyqrcode >>> qr = pyqrcode.create(“HORN O.K. PLEASE.”) >>> qr.png(“horn.png”, scale=6) Decode an existing qrcode file using … Read more

PHP replacing special characters like à->a, è->e

There’s a much easier way to do this, using iconv – from the user notes, this seems to be what you want to do: characters transliteration // PHP.net User notes <?php $string = “ʿABBĀSĀBĀD”; echo iconv(‘UTF-8’, ‘ISO-8859-1//TRANSLIT’, $string); // output: [nothing, and you get a notice] echo iconv(‘UTF-8’, ‘ISO-8859-1//IGNORE’, $string); // output: ABBSBD echo iconv(‘UTF-8’, … Read more

How to decode a string encoded with openssl aes-128-cbc using java?

Solved it using Bouncy Castle library. Here is the code: package example; import java.util.Arrays; import org.apache.commons.codec.binary.Base64; import org.bouncycastle.crypto.BufferedBlockCipher; import org.bouncycastle.crypto.CipherParameters; import org.bouncycastle.crypto.InvalidCipherTextException; import org.bouncycastle.crypto.engines.AESEngine; import org.bouncycastle.crypto.generators.OpenSSLPBEParametersGenerator; import org.bouncycastle.crypto.modes.CBCBlockCipher; import org.bouncycastle.crypto.paddings.BlockCipherPadding; import org.bouncycastle.crypto.paddings.PKCS7Padding; import org.bouncycastle.crypto.paddings.PaddedBufferedBlockCipher; public class OpenSSLAesDecrypter { private static final int AES_NIVBITS = 128; // CBC Initialization Vector (same as cipher block size) [16 … Read more

tech