widget: edit/textbox: use text_encoding to deal with encoding

text_encoding provide APIs to deal with variable length encoding. Port
edit and textbox to it.