[1.7.x] Fixed #23265 -- Used system-specific encoding in runserver

Thanks SpaceFox for the report.
Backport of 055d95fce066 from master.