unicode handling for entity extraction