[1.7.x] Applied unicode_literals to makemessages command

This also fixes #22686 as some sort of side-effect.
Backport of dbb48d2bb99 from master.