senaite / senaite.core

Enterprise Open Source Laboratory System (LIMS)
https://senaite.com
GNU General Public License v2.0
254 stars 145 forks source link

Fix UnicodeDecodeError when user linked to a contact with special chars #2618

Closed xispa closed 1 month ago

xispa commented 1 month ago

Description of the issue/feature this PR addresses

This Pull Request fixes a traceback that occurs in user-information view when the user is linked to a contact that contains special characters on its full name.

Current behavior before PR

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 176, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 385, in publish_module
  Module ZPublisher.WSGIPublisher, line 288, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 63, in call_object
  Module senaite.core.browser.user.userdatapanel, line 78, in __call__
  Module senaite.core.browser.user.userdatapanel, line 147, in notify_linked_user
  Module zope.i18nmessageid.message, line 113, in __call__
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 44: ordinal not in range(128)

Desired behavior after PR is merged

No traceback

-- I confirm I have tested this PR thoroughly and coded it according to PEP8 and Plone's Python styleguide standards.