[1.7.x] Fixed #23888 -- Fixed crash in File.__repr__() when name contains unicode.

Backport of 1e9ac504e4 from master