-
Notifications
You must be signed in to change notification settings - Fork 15
Conversation
Changing the default encoding to cp437, with the possibility to fall back to ascii.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this library also supports the microcontrollers, which use UTF-8 encoding and basically ignore this parameter, I think changing the default to something else would confuse users expecting it on those devices - technically, it shouldn't even be ASCII currently.
Additionally, since this is only for the internal _write_char()
function, there's no way to modify in a public function like print()
.
I think a solution could be to provide an encoding argument to print()
(and any functions like it) with a default of utf-8
(despite that the printer probably doesn't necessarily support all UTF-8), pass that down to the function you changed, and explain in the public functions that the argument is only supported on Blinka platforms like the Raspberry Pi.
Implementing requested changes.
Specifying encoding in the legacy code
I don't understand exactly why the tests failed... Important notes: I chose to force the keyword encoding in the function However, following PEP, I also made the options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes!
The CI is failing because it wants to reformat the file. You run pre-commit yourself, and then commit the changes it automatically makes.
Looks like we're just missing the note that only UTF-8 is available for CircuitPython, but otherwise looks good! |
Hi! Looks like there's one remaining change needed, as well as a merge from main needed. Let me know if you're still working on this, otherwise I'm happy to finish it :) |
Sorry, this got lost in the other stuff. Added the note. |
No worries! I'll take a look at this soon :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Updating https://github.com/adafruit/Adafruit_CircuitPython_Thermal_Printer to 1.4.0 from 1.3.12: > Merge pull request adafruit/Adafruit_CircuitPython_Thermal_Printer#29 from mushunrek/main > Add .venv to .gitignore Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
Changing the default encoding to cp437, with the possibility to fall back to ascii.