Partially: revert r8636, apply r8741,r8750.
Partially: revert r8636, apply r8741,r8750.

r8636 introduced a temporary fix for unicode problem #3081100. In r8741, a
more permanent solution was introduced. This solution was slightly changed in
r8750. The last solution is ported to rewrite in this commit.

https://mediawiki.org/wiki/Special:Code/pywikipedia/8877

darthbhyrava/pywikibot-local,icyflame/batman,PersianWikipedia/pywikibot-core,wikimedia/pywikibot-core,emijrp/pywikibot-core,happy5214/pywikibot-core,jayvdb/pywikibot-core,h4ck3rm1k3/pywikibot-core,wikimedia/pywikibot-core,trishnaguha/pywikibot-core,npdoty/pywikibot,magul/pywikibot-core,h4ck3rm1k3/pywikibot-core,npdoty/pywikibot,jayvdb/pywikibot-core,hasteur/g13bot_tools_new,magul/pywikibot-core,smalyshev/pywikibot-core,happy5214/pywikibot-core,hasteur/g13bot_tools_new,valhallasw/pywikibot-core,Darkdadaah/pywikibot-core,xZise/pywikibot-core,TridevGuha/pywikibot-core,hasteur/g13bot_tools_new,VcamX/pywikibot-core,Darkdadaah/pywikibot-core