c# - web service utf8 arabic decoding -
i built c# web service accepts unicode characters have client consumes web service php insert data ms sql database runs correctly english characters when push arabic text insert "???????" chars database
i tried decode utf8 unicode no luck
here conversion code:
private byte[] getrawbytes(string str) { int charcount = str.length; byte[] byttemp = new byte[charcount]; (int = 0; < charcount; i++) { byttemp[i] = (byte)str[i]; } return byttemp; } private string utf8tounicode(string str) { byte[] bytutf8; byte[] bytunicode; string strunicode = string.empty; bytutf8 = getrawbytes(str); bytunicode = encoding.convert(encoding.utf8, encoding.unicode, bytutf8); strunicode = encoding.unicode.getstring(bytunicode); return strunicode; }
Comments
Post a Comment