trivial refactoring of encoding conversion & fix for mb_convert_string() with UTF-8(thanks to @alexborisov)