Open laulaz opened 4 years ago
when the method encounters a character that cannot be encoded in the target character set (in this case, ASCII), it raises a UnicodeEncodeError. So, using decode('utf8', 'ignore') modifies the behavior of the decode() method to ignore any non-encodable characters in the string. This means that the resulting Unicode string will not contain the problematic characters, but they will simply be omitted from the final output. This is potentially a good solution but its quick and effective for cases where the problematic characters are not critical to the application or system.
@Coder-aadarsh Generally Plone uses utf-8 encoding, not ascii. We should make this work correctly with non-ASCII characters, not make it silently ignore them. There is a good chance this is already working fine in recent Plone versions with Python 3; someone needs to check.
UnicodeEncodeError
duringportal_upgrade
when you have accentuated characters in content type title.In our case, the content type were created in French, through ZMI :
https://github.com/plone/plone.dexterity/blob/fcb0253d2e5237e98ab1f159f77d23db2906b525/plone/dexterity/fti.py#L213