title: C# ESC POS Special characters
body: <p>I'm making a class for ESC POS printing.</p>
  
  <p>It needs to support special norwegian characters: ÆØÅæøå</p>
  
  <p>The problem is that I can't just use them in a string.</p>
  
  <p>"Data to print: ÆØÅæøå" will print as "Data to print: ??????"</p>
  
  <p>According to the documentation these chars prints the special characters i need:</p>
  
  <p>(char)91 prints "Æ"</p>
  
  <p>(char)92 prints "Ø"</p>
  
  <p>(char)93 prints "Å"</p>
  
  <p>(char)123 prints "æ"</p>
  
  <p>(char)124 prints "ø"</p>
  
  <p>(char)125 prints "å"</p>
  
  <p><strong>So my question is:</strong> Is there any better way than to do a Replace for each of the characters?</p>
  
  <p>Here is the code that connects to printer and sends data:</p>
  
  <pre><code>        Socket clientSock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
          clientSock.NoDelay = true;
          IPAddress ip = IPAddress.Parse("192.168.0.11");
          IPEndPoint remoteEP = new IPEndPoint(ip, 9100);
          clientSock.Connect(remoteEP);
          byte[] byData = Encoding.ASCII.GetBytes(buffer);
          clientSock.Send(byData);
          clientSock.Close();
  </code></pre>
  
  <p><strong>Solved:</strong></p>
  
  <pre><code>Encoding nordic = Encoding.GetEncoding("IBM865");
  byte[] byData = nordic.GetBytes(buffer);
  </code></pre>