[reportlab-users] String shapes and encodings
Claude Paroz
claude at 2xlibre.net
Wed Jun 8 02:51:47 EDT 2022
Le 08.06.22 à 04:31, Lennart Regebro a écrit :
> On Tue, Jun 7, 2022 at 10:40 AM Robin Becker <robin at reportlab.com
> <mailto:robin at reportlab.com>> wrote:
>
> I don't think I would like to apply this patch anytime soon. If
> others have an opinion please speak up.
>
>
> As I understand it, the encoding will simply be ignored if a unicode
> string is given, so keeping the possibility of passing in a bytestring
> and an encoding is not a problem, even though it's no longer necessary.
No, the isUnicode check would force text input to be Unicode (a normal
Python string). The encoding parameter should be deprecated/removed at
some point.
So instead of String(b'd\xe9j\xe0', encoding='latin-1'), users should
pass String(b'd\xe9j\xe0'.decode('latin-1')).
Claude
--
www.2xlibre.net
More information about the reportlab-users
mailing list