Fixed textinput height calculation based on padding

Also fixed encoding declaration for textinput.py

This resolves #2367