How to SMS string that base on Base64 - windows-phone-7

HI,
anything different between string and string that base on Base64? I can send out string by SMS programmaticallly. But not sure this will apply to string that is base on Base64. can someone provide guidance what need to be done on the string base on Base64 and send it by SMS. Thanks

Do you mean you want the text message to just contain the base64 string itself? That should work fine - as far as I'm aware, all the characters used within base64 are also available in text messages. If you mean you want to send arbitrary binary data which you happen to have in base64 form at the moment, that could be harder. It wouldn't really be "text" at that point - I dare say there's a way of sending it (possibly MMS etc) but you should be looking at APIs which take byte arrays rather than strings at that point.

have you tried to send a Base64String via SMS?
EDIT... thanks to Jon :)
At the risk of another downvote by the almighty Jon Skeet ;) I will provide "some" help... #MilkBottle, if you have a byte[] and you convert it (for example with Convert.ToBase64String) you can send the result as a smsbody. I cannot understand, why you want to do this, but that doesn`t matter. Another (bad) example:
byte[] arr = new byte[] {0x02, 0x04, 0x07};
String smsbody = System.Convert.ToBase64String(arr);
The result will look like this "AgQG" and this is able to be send programmatically with the SmsComposerTask.
Hope that helps...

Related

How to decode base64 & hexadecimal response from query

The query comes as
"returnData": [
"zWCLtKpUXZbkWNM9deAVPizTxXASOjX63ubdUHDN+vw=",
"zWCLtKpUXZbkWNM9deAVPizTxXASOjX63ubdUHDN+vw="
],
How can I decode that string? I can see it is decodable base64 first, but I get a very weird string after. Can someone show me the steps to follow to receive the decoded final string?
Base64 encodes binary data, which means if you send data that is not a string you won't be able to retrieve a string back. So to properly parse the return data you will need to know what data types were actually returned.
It might also be helpful to use a base64 to hex decoder first, so you get the hex representation of your data.
To give you more concrete recommendations we would need to know what data you expected, preferably showing the whole endpoint definition as well as any custom structs that might be involved.

Reading Japanese query parameters from the URL

I am getting query parameter as "ã\\u0083\\u008eã\\u0083¼ã\\u0083\\u0096ã\\u0083©ã\\u0083³ã\\u0083\\u0089å\\u0093\\u0081" in my controller for Japanese character "ノーブランド品".
Is there a way to translate all query parameters into UTF-8?
I have tried multiple solutions but it does not seem to be working
Solution I tried
URLDecoder.decode(string, "UTF-8");
Another solution I tried is
ByteBuffer buffer = StandardCharsets.UTF_8.encode(encodedName);
decodedName = StandardCharsets.UTF_8.decode(buffer).toString();
Is there a way to decode the string back to Japanese once it is translated? Reason am asking is because page that is calling us is not owned by us
Thanks

CapnProto encodes string twice

I have a simple struct containing some stuff, and also a Text field. I was looking at the result of encoding this data using Capnp, and for some reason the value of the text field appears in the encoded output twice! That doesn't seem very efficient or sane. Why does this happen?
Cap'n Proto does not encode text fields twice. To understand what happened in your case, we'd need to see your code.

How do I convert a string of utf-8 codes into the actual string

I am writing a little tool that emulates a user on a webpage and want to process the information I get. The tool is written in Ruby(Version > 2.0).
Unfortunately I don't receive the string but an UTF-8 representation of the actual string. Something like this:
"\u0000\t\u0000\t\u0000N\u0000\t\u0000N\u0000\t\u0000\n"
How do I convert this string back into a "normal" string?
Thank you

Ajax Push Engine (APE): How to Send Binary Data or Special Characters

This code example is from the APE official website: http://www.ape-project.org/
var client = new APE.Client();
client.load();
client.core.join('testChannel');
client.request.send('foo', {ping: 'ho hey', fieldWidthBinaryDataOrSpecialCharacters: '+/'});
client.onRaw('bar', function(raw, pipe) {
console.log('echo : ' + raw.data.echo);
console.log('Receiving : ' + raw.data.hello);
});
When I receive the data at the server side, I found that the special characters +/ has been URL encoded (%2B%2F).
Is APE always using GET? If we use POST, I think we can post any data including Binary data, right? But how to use POST in JSON?
My case is, even I don't use the Binary format, I have to use the Base64. But the standard Base64 uses +/ which is not URL safe. You might suggest using the URL safe version of Base64, but URLSafeBase64 is not standard and it might also create other problems.
Am I misunderstanding something?
Thanks.
Peter
I finally did two-step encoding:
The Client Side:
Base64 Encoding;
Server Side:
URL Decoding; (It seems the URL encoding is automatically done somewhere in the APE)
Base64 Decoding.
P.S.: If any one knows how to do it in a more efficient way of transferring binary data, please let me know, and I will re-mark your answer as the correct one.

Resources