This replaces convert_from/to_utf8 in a way that doesn't leak memory. Use the new method in StyledEdit. Fixes #6252, #3065.