This workflow takes selected text in the Editorial editor and replaces it with HTML encoded character strings.
It’s just a few actions:
The magic is in the bit of Python that uses the CGI module and should handle most non-english characters as well as special characters like emdash.
:::python #coding: utf-8 import workflow import cgi action_in = workflow.get_input() tempString = workflow.get_variable('origString') encodeString = cgi.escape(tempString).encode('ascii', 'xmlcharrefreplace') #TODO: Generate the output... action_out = encodeString workflow.set_output(action_out)
You can download the workflow