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?


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -