I am down to the script activity which isn't the best fit since there are so many possible characters. Examples: " and '
Thanks!
I am down to the script activity which isn't the best fit since there are so many possible characters. Examples: " and '
Thanks!
Chris,
If I understand your question correctly you are asking for a way to decode encoded HTML? If so, you can decode any encoded text in the Script activity with a single line of code using the HTMLDecode method on the System.Net.WebUtility class.
Here is some sample code that takes an encoded text string from a token named EncodedHTML and correctly decodes it to a token named DecodedHTML. The script correctly decodes both examples you cite.
Imports System Imports System.Collections.Generic Imports System.ComponentModel Imports System.Data Imports System.Data.SqlClient Imports System.Text Imports System.Net Namespace WorkflowActivity.Scripting.Script '''<summary> '''Provides one or more methods that can be run when the workflow scripting activity is performed. '''</summary> Public Class Script1 Inherits ScriptClass90 '''<summary> '''This method is run when the activity is performed. '''</summary> Protected Overrides Sub Execute() Me.SetTokenValue("DecodedHTML", System.Net.WebUtility.HtmlDecode(Me.GetTokenValue("EncodedHTML"))) End Sub End Class End Namespace
Ha ha yeah I found this yesterday and it is just what I needed. Thanks for the reply!
https://stackoverflow.com/questions/122641/how-can-i-decode-html-characters-in-c
Note: you need to add 'using System.Net' or 'Import System.Net'(as shown above) in the top section of the scripting interface to be able to use 'DecodeHTML'.
I am pulling a block of text from another system (Synergy API) and it's converting special characters to HTML. This converts it all back to text data type.