Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9306063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T00:05:18+00:00 2026-06-19T00:05:18+00:00

I have an issue where if I pass a hardcoded string \x1B|200uF as a

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T00:05:20+00:00Added an answer on June 19, 2026 at 12:05 am

    The problem lies (as @OlafDietsche pointed out) indeed in the XML file. In the C# string, \x1B means “the character with code 1B (hex) or 27 (dec)”, in XML it’s just the four characters.

    So you’ll have to encode the special character inside your XML document differently. Theoretically, you’d simply replace \x1B with , which is the XML way of saying “the character number 1B (hex)”. The problem in this specific case, however, is that  is not allowed in XML. The valid characters in an XML document are defined here: http://www.w3.org/TR/xml/#charsets
    Note how #x1B is not part of this range.

    You could use a different character to represent Escape in the XML and replace it inside your C# code. Make sure to use a surrogate character that a) is a valid XML character and b) would never be used as actual data.

    For example, choose xFEED as your escape char (as it is easy to recognize). So your document looks like:

    <FeedReceiptCommand value="&#xFEED;|200uF"/>
    

    In your C# code, replace it accordingly:

    string actualValue = reader.GetAttribute("value").Replace('\xFEED', '\x1B')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an issue in that a Symfony2 form can pass validation but still
I have an issue where I read the value from textbox and pass its
I have a modeling issue with Symfony2/Doctrine2. I am currently trying to pass a
I have an issue where I need to pass in query parameters for a
But default you have to issue an HTTP POST to any web method in
I have an issue where I need to pass multiple criteria for a single
I have an issue while parsing my Solr Queries that I pass on the
Small but annoying issue with crystal reports. I have a report connecting to a
I have an issue where I need to pass the Session ID to a
I have an issue with IE7 not wanting to pass a pickled object through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.