In the compat , BaseSite.urlEncode moved wpEditToken to the last arg as recommended by the API documentation, and it did utf8 encoding.
POST parameter encoding in core is now performed mostly in pywikibot.data.api.Request. This class does encoding properly, but does not re-order the parameters. To fix this, any parameter named '*token' should be moved to the end.
The deprecated BaseSite.urlEncode in core also needs to be updated so it is backwards compatible.
Tests need to be created to verify that pywikibot.data.api.Request and BaseSite.urlEncode re-order parameters, and very basic tests are needed to verify that BaseSite.urlEncode encodes the parameters correctly.