That decode function was in the comments in the manual of utf8_decode, apparently taken from the sources of SquirrelMail. Nice!

Important also is setting that internal encoding, could also be done in php.ini I guess.

EDIT: some more info, I tried 'everything' related to doctype, meta tags, php header setting of charset (needed according to a lot of other solutions), physical file type (needed for literals in the page) etc but took it all out and it still works, no meta, no charset header, showing cyrillic text. Just the internal encoding seems important, as well as the alternative way to handle htmlentities.