question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't print special characters ?

See original GitHub issue

Hi, I’m having a little bit of an issue with printing accents and I would like your help.

Informations:

Printer: Epson TM-20III Os: Windows 10

Here’s the problem:

  • Printing any special character (é, ç, ë, …) will give another special character (é becomes Ú for example).

Heres what I tried:

  • I took a look at #67 and tried multiple CodePage but I still get the correct characters.

  • I also tried to identify which encoding was returned by e.PrintLine("é") so that I could maybe convert it to the correct encoding but I couldn’t identify which encoding was used in the returned byte[].

  • I modified my CodePage and language from US to French from the EPSON Utility but nothing changed.

  • I successfully printed a test page of the codepage, including special characters.

At this point I’m kind of lost. I could parse all the special characters out of my string but I hope that I don’t have to do that…

If you could give me some information it would be greatly appreciated 🙏

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rsantosdevcommented, Sep 8, 2021

Thanks, @NgyAnthony for posting this. This was the solution to make the euro symbol and the British pound symbol work as expected.

Just some small comments if anyone has the same issue:

1 - You need to register the IBM00858 encoding:

// On your Program.cs add this line
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
1reaction
NgyAnthonycommented, Oct 8, 2020

Hi, thanks for your explanation, it was very clear.

I managed to be able to print accents with this snippet:

        public void PrintTest()
        {
            string unicodeString = "ééééééàçàçàç";
            byte[] tempBytes = Encoding.GetEncoding("IBM00858").GetBytes(unicodeString);
            
            printer.Write(
              ByteSplicer.Combine(
                e.CodePage(CodePage.PC858_EURO),
                tempBytes,   // Works
                e.Print(Encoding.GetEncoding("IBM00858").GetString(tempBytes)), // Doesn't work
                e.Print(Encoding.ASCII.GetString(tempBytes)), // Doesn't work
                e.PrintLine("Test"),
                e.FullCutAfterFeed(30)
              )
            );
        }

However I’m unable to use the library’s functions (e.Print or e.PrintLine), I have to give the ByteSplicer my byte array directly. Any idea on how I could convert my byte array to a string that is accepted by e.PrintLine ?

Thanks again for the input !

Edit: On second thought I don’t think it really matters if I’m not using e.Printline, this issue could be considered as solved

Read more comments on GitHub >

github_iconTop Results From Across the Web

Special Characters Printing
From your description, it seems that the Word document is printed in symbols, letters and special characters rather than the “normal text”.
Read more >
Some Special Characters are not printing or displaying ...
Some characters in Docs and Slides display as one way in the editor, but when printed, change their appearance or turn into a...
Read more >
error when printing special characters in C. The problem is ...
In conclusion: when I try write special characters with %c, I cannot see it. ... With what text encoding? %c prints one char,...
Read more >
Terminal doesn't print special characters after changing to ...
Go to Terminal > Preferences > Keyboard and uncheck the box for Use Option as Meta Key.
Read more >
Solved: missing special characters
When printing from a PDF, the printer seems to not be able to print specific characters (in this case, characters generated by an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found