matteoathen

Hi All,

I need help. Does anyone know how to do encoding/decoding an SMS text The text, would be sent through GSM channel in ASCII text and NOT in binary.

I am doing the application on Visual Studio 2005 C#, Windows Mobile 5.0.

Many thanks in advance.

Regards,

Matteoathen



Re: Smart Devices VB and C# Projects Base64 Encoding/Decoding

Christopher Fairbairn

Hi,

Base64 encoding can be done via static methods within the System.Convert class, for example:

Code Snippet

// To encode

byte[] data = new byte[]{ 1, 2, 3, 4 };

string base64encodedData = Convert.ToBase64String(data);

// To decode

string data = "AQIDBA==";

byte[] binaryData = Convert.FromBase64String(data);

For more details see MSDN - http://msdn2.microsoft.com/en-us/library/dhx0d524.aspx

Hope this helps,

Christopher Fairbairn






Re: Smart Devices VB and C# Projects Base64 Encoding/Decoding

matteoathen

Hi Christ,

Thanks for the quick reply. From what you say, i need to use the system.convert class. However, i do not see the system.convert class in the project referrence. Can it be used in the development of smart device

http://i120.photobucket.com/albums/o176/kenny_2828/proj.jpg

Many thanks in advance.

Regards,

Matteoathen





Re: Smart Devices VB and C# Projects Base64 Encoding/Decoding

Christopher Fairbairn

Hi Matteoathen,

Sorry for the confusion. The Convert class lives within the System namespace and lives in the System.dll assembly. Your project probably already has a reference to this assembly.

You should be able to copy and paste the code sample I provided into your existing project without needing to include any additional assembly references etc.

At the most you may need to add a "using System;" statement to the top of your source file (but this is probably already present).

Hope this helps,

Christopher Fairbairn






Re: Smart Devices VB and C# Projects Base64 Encoding/Decoding

matteoathen

Hi Christ,

Thanks for the help. Really appreciate it : )

Regards,

matteoathen