I have a Star Micronics TSP that supports CodePage 1001 Arabic, how do I convert UTF-8 to that specific code page using C#?
Update: I found out that CodePage 864 is compatible with the printer, I tried sending hex values and I got the correct character,
myPrinter.PrintNormal(PrinterStation.Receipt, "\xFE8D");
I tried the following to convert a string to codePage 864:
Encoding enc = Encoding.GetEncoding(864);
byte[] arr = enc.GetBytes("السلام");
the byte arr values i’m getting after the encoding is {63,63,63,63,63,63} which is wrong in value and even the byte count is wrong because its a double byte character.
Untested, but:
Of course, skip the first line if you are actually starting with a string, but since you mention UTF-8 I assumed binary.
Obviously for large data volumes you might use a
TextReader/TextWriter(each with encoding) instead – but same idea.