encode tag names