c# - Using correct encoding when reading from TCP/Port -
i'm reading byte stream (byte[]
) tcp/port, , converting subsection of recieved array char[]
assume not familiar characteristics of port, nor environment on other side of port. know there port.
part of data recieve encoded uk pound currency symbol (£). when use ascii encoding conversion, these symbols come through ?
var chararray = encoding.ascii.getchars(bytearray);
however, when use utf-7, ok:
var chararray = encoding.utf7.getchars(bytearray);
i should add when trying utf-8, doesn't work.
this trial , error, , i'm not entirely sure why might have worked. rather go ahead , deploy solution, thought i'd try understand more why might have worked.
is system on other side of port transmitting in utf-7, or there else going on?