Fix errors when tags contain non-ANSI character