Fix bug in padding unicode, #17105.

Could you add a test for this change as well?