Added helper function to obtain utf8 string ending

Thought the use of strbuf was not necessary here.