vergrooting

 The Internet is the world's largest library. It's just that all the books are on the floor 

~John Allen Paulos - professor of mathematics

Unicode to stringDoor René Goris op maandag 07 mrt 2011 om 10:17:31

On receipt of SMS messages, some the body parameter was not recognized was send in Unicode. That is because the sender has his/hers phone settings string set to UNICODE instead of GSM. So I needed a translation from Unicode t0 string (ASCII), below t

On receipt of SMS messages, some the body parameter was not recognized was send in Unicode. That is because the sender has his/hers phone settings string set to UNICODE instead of GSM.
So I needed a translation from Unicode t0 string (ASCII), below the code:

string unicodeString = "0074006500730074";
string asciString = "";
for (int i = 0; i < (unicodeString.Length) - 1; i+=4) {
 int asciNumber = Convert.ToInt32(unicodeString.Substring((i+2),2),16);
 asciString += char.ConvertFromUtf32(asciNumber);
}
Response.Write("Unicode: " + unicodeString + "<br/>" + "String: " + asciString);


Reacties

Er zijn (nog) geen reacties!

Reageer

Naam:  
Email:  
Website:
Opmerking:  
Controle getal:
(3 cijfers, klik op het plaatje om hem te verversen!)
 
 
Partners
NatuurNetwerkMandaatkrachtMaasmond B.V.