my issue is when I try to encode an image to base-64, it generate a long string (up to 200,000 lines) and it doesn't work in the decoding, it generate a nil image! even I try to resize the image to a smaller size but still it doesn't work!
Here is my image encoding code
let image = imageView.imagelet imageData:NSData = UIImagePNGRepresentation(image!)! as NSDatalet strBase64 = imageData.base64EncodedString(options: .lineLength64Characters)
The decoding code:
let processImage = user.value(forKey: "processImage") as! String // image from json if let dataDecoded:NSData = NSData(base64Encoded: processImage, options: NSData.Base64DecodingOptions.ignoreUnknownCharacters) { let image: UIImage = UIImage(data:dataDecoded as Data,scale:1.0)! print(image.size) self.myImage.image = image }
I was wondering if it's possible to transfer arbitrary binary data through messaging apps such as Telegram. I guess the question is if binary data can be transferred through text messages. I read somewhere that this is possible if Base64 binary-to-text encoding is used. Telegram is a platform which is not censored in the country I'm living in. So, if I can relqy binary data through telegram, it can be used to bypass censorship. Does telegram support Base64 encoding? What are your thoughts on this?
I'm trying to encode/decode a file that is several MBs or sometimes GBs in base64 encoding however some pieces of data gets encoded/decoded in a wrong way which results in strange characters like: � �̴.
I'm reading the file chunk by chunk encrypting and saving each individually (Probably that's the problem however i cannot figure it out).
Here is what i have tried so far:
<?phpfunction encrypt_file($Ifilename, $Efilename){ $handle = fopen($Ifilename, 'rb'); $outHandle = fopen($Efilename, 'wb'); $bufferSize = 8151; while(!feof($handle)){ $buffer = fread($handle, $bufferSize); $ebuffer = base64_encode($buffer); fwrite($outHandle, $ebuffer); } fclose($handle); fclose($outHandle);}function decrypt_file($Ifilename, $Efilename){ $handle = fopen($Ifilename, 'rb'); $outHandle = fopen($Efilename, 'wb'); $bufferSize = 8151; while(!feof($handle)){ $buffer = fread($handle, $bufferSize); $dbuffer = base64_decode($buffer); fwrite($outHandle, $dbuffer); } fclose($handle); fclose($outHandle);}encrypt_file('input.txt', 'out.bin');//Big text file ~4MBsdecrypt_file('out.bin', 'out.txt');
I am puzzled at this base64 decoding issue, and it seems that python and node.js does this differently. Node does this correctly I believe. Could anyone help point out why python does not work here?
Thank you.
Node
> console.log(Buffer.from('Im3Osc6_z4HPgc-J==', 'base64').toString());"mαορρω
Python
>>> from base64 import decodestring>>> print decodestring('Im3Osc6_z4HPgc-J==')"mαγ?s?p
Can I somehow encode string field into base64 field using Tableau Desktop only?
I didn't find any function for this, probably there is a way to do it.
Casa - Mappa del sito - Vita privata - Links - Copyright © 2018 Cortex IT Ltd : Contatto : admin @ cortexit.co.uk
Please note that by viewing our site you agree to our use of cookies (see Vita privata for details). You will only see this message once.