Discussed in #4971
Originally posted by dantard April 20, 2026
Hello,
I'm working with a PDF file that includes form fields such as radio buttons and checkboxes. After a few hours of debugging, I identified a specific issue: when the on_state value of a checkbox or radio button contains accented characters, calling widget.update() fails. That is:
widget.field_value = True
widget.update()
throws:
File "/home/danilo/python-venv/lib/python3.12/site-packages/pymupdf/mupdf.py", line 53520, in pdf_set_field_value
return _mupdf.pdf_set_field_value(doc, field, text, ignore_trigger_events)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'pdf_set_field_value', argument 3 of type 'char const *'
In my particular case, the on_state is set to S#ED, which is intended to represent “Sí”. This encoding seems to be the root of the problem.
From what I can tell, this may be related to how the PDF library or underlying encoding handles non-ASCII characters in form field values.
Has anyone encountered a similar issue? If so, how did you handle or work around it?
Any insights or suggestions would be appreciated.
Thanks is advance.
Discussed in #4971
Originally posted by dantard April 20, 2026
Hello,
I'm working with a PDF file that includes form fields such as radio buttons and checkboxes. After a few hours of debugging, I identified a specific issue: when the
on_statevalue of a checkbox or radio button contains accented characters, callingwidget.update()fails. That is:throws:
In my particular case, the
on_stateis set toS#ED, which is intended to represent “Sí”. This encoding seems to be the root of the problem.From what I can tell, this may be related to how the PDF library or underlying encoding handles non-ASCII characters in form field values.
Has anyone encountered a similar issue? If so, how did you handle or work around it?
Any insights or suggestions would be appreciated.
Thanks is advance.