"add custom gcode at layer" encodes quotes wrong and causes klipper error
Hi,
I'm running 2.6.1 on an M1 Macbook, sending prints to Klipper v0.11.0-65 firmware.
I have a print which requires many filament swaps so I'm using the "add custom gcode at layer" feature to insert two lines, a 'RESPOND' command and a 'PAUSE' command. When Klipper gets to the RESPOND command it throws an error and terminates the print (yes, Klipper has some truly lazy error handling, but that's not what this is about). After much testing, I discovered that typing the quote marks into the "add custom gcode at layer" popup creates quotes in an incompatible encoding (non ASCII/UTF-8, I assume) that Klipper can't handle (yes, the printer firmware is defined as "Klipper" for my printer in the PrusaSlicer Printer Settings).
Below, the 1st line is what results from typing double quotes into the "add custom gcode at layer" popup. The 2nd line I tried typing two single quotes, 3rd line I tried two back-tics and finally the 4th line (which does not cause the error) is from pasting the line from a text editor that's set for UTF-8 text encoding after typing it there.
RESPOND MSG=“Load Sunrise Orange” RESPOND MSG=‘’Load Sunrise Orange’’ RESPOND MSG=``Load Sunrise Orange`` RESPOND MSG="Load Sunrise Orange"
What I can't test is if this is specific to the Mac version or M1 Macs running the Mac version. I'm using the default system font's so I don't think the issue is specific to my setup.
For now I can use the cut/paste from editor work-around but can anyone verify this issue on their Windows | Linux | Intel Mac | M1/M2 Mac please?
Thanks!
Best Answer by _KaszpiR_:
Uh this stuff again, seen it in other places, not only in printing but usually in programming.
The first one looks like 'special' double quotes, that some editors use, especially the builtin ones in the Apple.
The last ones look like 'normal' quotes in coding editors.
I suggest checking locales on the mac and using standard US keyboard, maybe you have different keyboard layout?
RE:
Uh this stuff again, seen it in other places, not only in printing but usually in programming.
The first one looks like 'special' double quotes, that some editors use, especially the builtin ones in the Apple.
The last ones look like 'normal' quotes in coding editors.
I suggest checking locales on the mac and using standard US keyboard, maybe you have different keyboard layout?
See my GitHub and printables.com for some 3d stuff that you may like.
RE: "add custom gcode at layer" encodes quotes wrong and causes klipper error
Your reply gave me the needed direction. My keyboard layout is US, but in System Settings/Keyboard the Text Input source can be edited and one of the options is for double and single quote style. The last option in the list is the one that's needed.
The quotes in PS Add Custom G-Code is now working as expected.
Thanks for the tip!