Was the need to print the page the result of the script. In the system console script gave some data with dates of the form:
Fri Jan 15 08:14.
When is my script displays them on the page, then the conclusion has already been as follows:
Пят Янв 15 08:14, while my page was encoding cp1251, and the output from the script came in KOI8-R.
Solution was simple.
default_charset = «CP1251 »