Skip to content

"Display Info on LCD" outputs ISO-8859-1, "Klipper preprocessor" cannot handle ISO-8859-1 #21624

Open

Description

Cura Version

5.12.1

Operating System

Debian GNU/Linux

Printer

Sovol SV08

Reproduction steps

Pretty much as the title says; the “Display Info on LCD” contains this:

        filament_line_t0 += f";  Print Temp.  : {self.global_stack.extruderList[0].getProperty("material_print_temperature", "value")}°\n"
        filament_line_t0 += f";  Bed Temp.    : {self.global_stack.extruderList[0].getProperty("material_bed_temperature", "value")}°"

Note the degree sign °, outputting a literal 0xb0. If you have “Klipper Preprocessor v1.4.1” later in the chain, it will get skipped because:

Unhandled exception:
'ascii' codec can't encode character '\xb0' in position 21: ordinal not in range(128)

You could argue that this is a bug of klipper-preprocessor, but G-Code in general is ASCII (and at the very least, this should be UTF-8, not ISO-8859-1).

Actual results

Unhandled exception:
'ascii' codec can't encode character '\xb0' in position 21: ordinal not in range(128)

Expected results

The simple fix would presumably be to just remove the degree symbol and replace it with “C” or similar.

Add your .zip and screenshots here ⬇️

N/A

Activity

  1. added
    Type: Bug
    Status: Triage
    on May 24, 2026
  2. GregValiant commented on May 24, 2026

    @GregValiant
    Collaborator

    Thanks for the report.
    It seems that substituting "\u00b0" for "°" should work.
    There are other post processors (mostly mine) that have "degree symbols" called out in them. I'll make those changes and submit them.

  3. added
    Status: Under Investigation
    and removed
    Status: Triage
    on May 24, 2026
  4. sesse commented on May 24, 2026

    @sesse
    Author

    I am honestly unsure; it could very well be that using UTF-8 instead of ISO-8859-1 would make the downstream scripts happier, but it might also depend on the environment variable PYTHONIOENCODING (I'm honestly not sure). Given that the error message talks about the “ascii” codec and not “utf-8”, I suspect using UTF-8 isn't entirely safe, but I wouldn't know for sure without actually building Cura from source again (which takes quite a bit of time on my laptop).

    Thanks for looking into this!

  5. GregValiant commented on May 25, 2026

    @GregValiant
    Collaborator

    It was 4 years ago when I made the original set of changes to "Display Info on LCD" and this is the first that this problem has been mentioned. When the next version of Cura is released, this change should be in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Under InvestigationType: Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions