From 577a9322010b0354ec01df42f72e9b3abff79057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 13 Oct 2019 08:18:38 +0200 Subject: [PATCH] core: add info about Python 3 and strings in release notes --- ReleaseNotes.adoc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ReleaseNotes.adoc b/ReleaseNotes.adoc index ba7b19b52..8102aaa5a 100644 --- a/ReleaseNotes.adoc +++ b/ReleaseNotes.adoc @@ -56,6 +56,26 @@ plugin, using this cmake option: cmake .. -DENABLE_PHP=OFF ---- +[[v2.7_python3_callbacks_strings]] +=== Strings received in Python 3 callbacks + +The strings sent to script callbacks in Python 3 are now automatically converted +according to the content: + +* if the string is valid UTF-8, it is sent as `str` (legacy behavior) +* if the string is not valid UTF-8, it is sent as `bytes` (new). + +In some cases only, the string may not be valid UTF-8, so it is received as +`bytes` in the callback, which must take care of that. + +For more information, see the WeeChat scripting guide: chapter about strings +received in callbacks (see also issue #1389). + +Note: there are no changes for Python 2 (which is now deprecated and should not +be used any more), the strings sent to callbacks are always of type `str`, and +may contain invalid UTF-8 data, in the cases mentioned in the WeeChat scripting +guide. + [[v2.7_irc_message_decoding]] === IRC message decoding/encoding