I have an issue where if I pass a hardcoded string \x1B|200uF as a parameter the command accepts it correctly.
But, when I retrieve the same value from an XML element into a new string variable I get the following value : \\x1B|200uF
As you can see there is an extra escape sequence.
So in summary the problem :
using (XmlReader xmlReader = XmlReader.Create(@"PosPrinter.xml"))
{
while (xmlReader.Read())
{
if (xmlReader.NodeType == XmlNodeType.Element)
{
switch (xmlReader.Name)
{
case "PosPrinter":
_printer.LogicalName = xmlReader.GetAttribute("LogicalName");
break;
case "FeedReceiptCommand":
_printer.FeedReceiptCommand = xmlReader.GetAttribute("value");
break;
I retrieve the value into my 'FeedReceiptCommand' string the value as I mentioned above is stored in the xml as \x1B|200uF but is retrieved into the string as \\x1B|200uF with the extra escape sequence at the beginning.
I then call my command using the string variable FeedReceiptCommand :
_posPrinter.PrintNormal(PrinterStation.Receipt, PrinterSettings.FeedReceiptCommand );
But the command doesn't execute because of the extra escape sequence.
But if I call the same command with the value hardcoded:
_posPrinter.PrintNormal(PrinterStation.Receipt, "\x1B|200uF");
... then the command gets executed successfully..
The value \x1B|200uF is the ESC command to send to a Epson TM-T88V printer using Microsoft.PointOfService whic the '\x' is for Hex I think and the 1B is the Hex value..
I have tried to get rid of the extra escape sequence by using 'Trim', 'Substring', and even doing a foreach loop to loop each char in the string to build a new one. I also tried stringbuilder.
But I'm missing the point somewhere here.
So any help would be appreciated in how I can pass a variable in place of the \x1B|200uF