Use the
BinaryWriter
class instead of the
StreamWriter
class and write the
win1252bytes
byte array:
byte[] unicodeBytes = Encoding.Unicode.GetBytes(printtemplate);
byte[] isoBytes = Encoding.Convert(Encoding.Unicode, Encoding.GetEncoding(28605), unicodeBytes);
writer = new System.IO.BinaryWriter(client.GetStream());
writer.Write(isoBytes);
If the output is then still wrong, ensure that the printer is using the 1252 encoding.