I have a base64 string (proabbaly) which convert to b2fb1d6c-567d-4d93-89cc-962bc67c6ec9
I believe this is related with an email id - how can i decode this?
Related
I am passing Base64 encoded String to API call, but when we receive in API it shows as space .
Eg.) Passing like this "kv+lluLOKRkGK6v+BqNPAPsx" But in API response
receive "kv lluLOKRkGK6v BqNPAPsx" like this.
Can anyone explain why swift not sending "+" symbol in API.
And Please tell how to solve this.
Use the proper Base64 variant that does not have the + character for REST calls: RFC 4648 base64url.
If you can't change the encoding, simply transcode the Base64 you receive.
Im passing following query string in browser which is encoded
http://abc/PreviewSurveyFormDetails.jsp?issueType=7t7Jpz2Oa8b6V5iy%2b6c6205ScixWnhYzj0FEuG6M1AhAOxcRXWDwWQ%3d%3d
While getting "issueType" in jsp page im getting decoded value
Following is the code
String str=request.getParameter("issueType");
Does browser decode automatically?.
Thanks in advance
This question already has answers here:
Convert base64 string to image
(9 answers)
Closed 7 years ago.
I have a post api where I am sending a json string which contain the base64 encoded image.Below is the json string
{ "imageData":"base64encoded string",
"status":"1"
}
where base64encode string is iVBORw0KGgoAAAANSUhEUgAAAHgAAACgCAIAAABIaz/HAAAAAXNSR0IArs4c6QAA\r\nABxpRE9UAAAAAgAAAAAAAABQAAAAKAAAAFAAAABQAABWL3xrAqoAAEAASURBVHgB\r\nlL2Fe1t7mueZme6uewNGMUu2LNkyySSjDJKZmZkSO8zM7CTmmJnZYbxUVbdgsKp7\r\nqqdrdp
I cant post the complete encoding since its too lengthy. How can I convert this encoded string into a image file at server side.Actually from there I suppose to upload the image on a ftp server.
Base64 uses Ascii characters to send binary files, so to retrieve your image, you basically have to decode the Base64 string back to a byte array and save it to a file.
String encoded = 'iVBORw0KGgoAAAANSUhEUg' // You complete String
encoded.replaceAll("\r", "")
encoded.replaceAll("\n", "")
byte[] decoded = encoded.decodeBase64()
new File("file/path").withOutputStream {
it.write(decoded);
}
Edit: You problem of invalid charatercomes from the \r\n characters you have in the encoded String, you must have your base64 string in one line to decode it. I updated the sample code to do it.
I get my mail from gmail.com with gmail gem.
gm = Gmail.connect addr, pass
in_m = gm.inbox.find(:before => 5.days.ago).last
puts in_m.text_part.body # shows "Привет ...."
puts in_m.subject # shows "=?KOI8-R?B?z9Qg09XQxdLXwcraxdLB?="
puts in_m.subject.encoding # shows #<Encoding:US-ASCII>
I tried
in_m.subject.encode("UTF-8")
in_m.subject.force_encoding("KOI8-R").encode("UTF-8")
in_m.subject.force_encoding("US-ASCII").encode("UTF-8")
this not help me
How i can encode the subject of my mail?
Thanks..
String like "=?KOI8-R?B?z9Qg09XQxdLXwcraxdLB?=" is the mime encoded word and this decoded Base64, charset=KOI8-R. Structure of mimeWord is =?charset?decode type?decoded string ?=. So if get part of string "z9Qg09XQxdLXwcraxdLB" and decoded this with Base64, then encode to UTF-8 all is OK. Base64.decode64("z9Qg09XQxdLXwcraxdLB").encode("UTF-8"). Question is closed
I have a string in my Redis DB containing encoded chars with accents:
hum... probl\xc3\xa0me :(
This is string is correctly read from DB (using node-redis)
hum... problème :(
But when it is sent to client (iOS app), utf8 encoding appears.
UPDATE
After some hours of struggle, I figure this out.
The retrieval from DB is ok, then the transport to the client leads to those encoded chars to be added. On client side I then correct the values , based on this SOP answer