in reply to UTF to character entities

Sure sprintf '&#x%X;', ord $1 or stick with HTML::Entities encode_entities_numeric