.net - Convert string base64 to string in C# without Encoding.UTF8.GetString -
i'm trying convert string base64 string in c# under unity3d. when try build on windows phone 8, error occurs because system.text.encoding not supported yet.
byte[] data = convert.frombase64string(encodeddata); string decodedstring = system.text.encoding.utf8.getstring(data);
i'm getting following error:
exception: error: method
system.text.encoding system.text.encoding::get_ascii()
doesn't exist in target framework
update:
i tried alternative of utf8.getstring:
public static string bytearraytostring(byte[] bytearray) { char[] chars = new char[bytearray.length / sizeof(char)]; system.buffer.blockcopy(bytearray, 0, chars, 0, bytearray.length); return new string(chars); }
it's supposed convert bytes string, utf8.getstring, got chinese characters! wonder if utf8.getstring other converting bytes string.
Comments
Post a Comment