Azure-Samples/MyDriving

OdbWrapper caused an error if non ASCII strings handled by ReadAsyncRaw method

MaxKhlupnov opened this issue · 0 comments

Line 313: ObdWrapper.cs
string recvdtxt = dataReaderObject.ReadString(bytesRead);

caused an error ("No mapping for the Unicode character exists in the target multi-byte code page.")

bellow code might fix:
byte[] buffer = new byte[bytesRead];
dataReaderObject.ReadBytes(buffer);
string recvdtxt = System.Text.Encoding.UTF8.GetString(buffer);
return recvdtxt;