replace UTF-8 parsing routine with working one