Reputation: 1189
I have an Arabic expression decoded using base64 and should be encoded in a function using vb.net, then filled in a dataset to be displayed in crystal report. Now the main problem is the below:
The retrieved data is decoded in base64 but I am not able to encoded and display it in Arabic properly. I have used 3 ways, but all of them are not displaying characters properly; If I take the expression and paste in an online converter, it will converted properly (so without doubts the expression was decoded correctly).
Dim test = "2YbYtSDZgdmKINin2YTZhNi62Kkg2KfZhNi52LHYqNmK2Kk="
Dim data = System.Convert.FromBase64String(test)
Dim endodedData = System.Text.ASCIIEncoding.ASCII.GetString(data)
returns: ???? ???? ?????????? ??????????????
Dim win= Encoding.GetEncoding("windows-1256")
Dim endodedData2 = win.GetString(data)
returns: ظ†طµ ظپظٹ ط§ظ„ظ„ط؛ط© ط§ظ„ط¹ط±ط¨ظٹط©
Dim iso = Encoding.GetEncoding("ISO-8859-6")
Dim endodedData3 = iso .GetString(data)
returns:
ع" & ChrW(134) & "ظ ع" & ChrW(129) & "ع" & ChrW(138) & " ظع" & ChrW(132) & "ع" & ChrW(132) & "ظظ ظع" & ChrW(132) & "ظظظع" & ChrW(138) & "ظ
The expected expression that should be returned should be : نص في اللغة العربية
Any help?
Upvotes: 0
Views: 726
Reputation: 1189
Ok I got it :
Dim endodedData4 = Encoding.UTF8.GetString(data)
Upvotes: 2