Title: Cannot figure out how to print \u2019 and other character codes properly · python-escpos/python-escpos · Discussion #458 · GitHub
Open Graph Title: Cannot figure out how to print \u2019 and other character codes properly · python-escpos/python-escpos · Discussion #458
X Title: Cannot figure out how to print \u2019 and other character codes properly · python-escpos/python-escpos · Discussion #458
Description: Cannot figure out how to print \u2019 and other character codes properly
Open Graph Description: Hello, I am using data from an API and often many symbols (like apostrophes and quotations) are represented by their Unicode character codes. They always print to the terminal fine without issue, b...
X Description: Hello, I am using data from an API and often many symbols (like apostrophes and quotations) are represented by their Unicode character codes. They always print to the terminal fine without issue, b...
Opengraph URL: https://github.com/python-escpos/python-escpos/discussions/458
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"QAPage","mainEntity":{"@type":"Question","name":"Cannot figure out how to print \\u2019 and other character codes properly","text":"\u003cp dir=\"auto\"\u003eHello,\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eI am using data from an API and often many symbols (like apostrophes and quotations) are represented by their Unicode character codes. They always print to the terminal fine without issue, but when I try to print to the printer it always encodes them incorrectly and spits out garbage.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eI know that the docs say the input needs to be Unicode and I’m pretty sure \\u2019 is a proper Unicode character code.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eI am using an Epson TM-T88IIP via USB on MacOS with the latest build of python-ecspos\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eThanks in advance,\u003cbr\u003e\nJack\u003c/p\u003e","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"\u003cp dir=\"auto\"\u003eHi Jack,\u003cbr\u003e\nso if you are on the newest (\u003ca href=\"https://pypi.org/project/python-escpos/3.0a8/\" rel=\"nofollow\"\u003ehttps://pypi.org/project/python-escpos/3.0a8/\u003c/a\u003e) version of python-escpos and assuming the library correctly know how to encode those characters, the last option would be that those characters are unknown to your printer.\u003c/p\u003e\n\u003cp dir=\"auto\"\u003eSome points that you could check:\u003c/p\u003e\n\u003cul dir=\"auto\"\u003e\n\u003cli\u003eHave you set the \u003ca href=\"https://python-escpos.readthedocs.io/en/latest/api/escpos.html#escpos.escpos.Escpos\" rel=\"nofollow\"\u003eprofile\u003c/a\u003e correctly?\u003c/li\u003e\n\u003cli\u003eMaybe this profile could work: \u003ca href=\"https://mike42.me/escpos-printer-db/#profiles/TM-T88II\" rel=\"nofollow\"\u003ehttps://mike42.me/escpos-printer-db/#profiles/TM-T88II\u003c/a\u003e\u003c/li\u003e\n\u003cli\u003eIf nothing helps, you could try to search and replace the conflicting characters or use a library such as \u003ca href=\"https://pypi.org/project/Unidecode/\" rel=\"nofollow\"\u003ehttps://pypi.org/project/Unidecode/\u003c/a\u003e\u003c/li\u003e\n\u003c/ul\u003e","upvoteCount":2,"url":"https://github.com/python-escpos/python-escpos/discussions/458#discussioncomment-1142635"}}}
| route-pattern | /_view_fragments/Voltron::DiscussionsFragmentsController/show/:user_id/:repository/:discussion_number/discussion_layout(.:format) |
| route-controller | voltron_discussions_fragments |
| route-action | discussion_layout |
| fetch-nonce | v2:6036f297-0213-dac4-a4b9-d8d7bba075ff |
| current-catalog-service-hash | 9f0abe34da433c9b6db74bffa2466494a717b579a96b30a5d252e5090baea7be |
| request-id | 8B1E:2E1914:132CFB3:1A01770:6A4D6F92 |
| html-safe-nonce | 65ce530fd674e5a1013c3138d21862bab64dadad85ca97a33f5654a4eaeb9bf2 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QjFFOjJFMTkxNDoxMzJDRkIzOjFBMDE3NzA6NkE0RDZGOTIiLCJ2aXNpdG9yX2lkIjoiODM3NjQzNjUwNjg0ODIyNzIxOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | fbd473ba5ce19c17e2a397ac6ffa259a993962e48863e09a919edddb564dc9d5 |
| hovercard-subject-tag | discussion:3505255 |
| github-keyboard-shortcuts | repository,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/Voltron::DiscussionsFragmentsController/show/python-escpos/python-escpos/458/discussion_layout |
| twitter:image | https://opengraph.githubassets.com/a7ccc65f21b833f680676230f8463d17c0f71992e4f5a2416997a1594ad728d9/python-escpos/python-escpos/discussions/458 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a7ccc65f21b833f680676230f8463d17c0f71992e4f5a2416997a1594ad728d9/python-escpos/python-escpos/discussions/458 |
| og:image:alt | Hello, I am using data from an API and often many symbols (like apostrophes and quotations) are represented by their Unicode character codes. They always print to the terminal fine without issue, b... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | c78260c7b3f4ac4b0356c8208537f05406a3a2d46a9ec3f735b372dcc519c39e |
| turbo-cache-control | no-preview |
| go-import | github.com/python-escpos/python-escpos git https://github.com/python-escpos/python-escpos.git |
| octolytics-dimension-user_id | 16302939 |
| octolytics-dimension-user_login | python-escpos |
| octolytics-dimension-repository_id | 32363483 |
| octolytics-dimension-repository_nwo | python-escpos/python-escpos |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 32363483 |
| octolytics-dimension-repository_network_root_nwo | python-escpos/python-escpos |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 399fff412f48461d435721c009efc17ea44be72f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width