cancel
Showing results for 
Search instead for 
Did you mean: 

Decode html encoded text like & &quote; ©

I want to decode html encoded text.

for insert database, push notification, send mail, from tweet text.

 

Example:

from & &quote; © to &, ", ©

 

I hope the Action for decoding html encoded text.

 

Regards,

Yoshihiro Kawabata

Status: New
Comments
Memorable Member

Now I decode html encoded string by Azure Functions.

and use the function from Microsoft Flow by HTTP.

and I hope Html Decode feature in Microsoft Flow, for lower cost, lower programming skill.

 

#r "Newtonsoft.Json"

using System;
using System.Net;
using Newtonsoft.Json;

public static async Task<object> Run(HttpRequestMessage req, TraceWriter log)
{
    log.Info($"HtmlDecode");

    string jsonContent = await req.Content.ReadAsStringAsync();
    dynamic data = JsonConvert.DeserializeObject(jsonContent);

    if (data.encodedString == null) {
        return req.CreateResponse(HttpStatusCode.BadRequest, new {
            error = "Please pass encodedString properties in the input object"
        });
    }

    return req.CreateResponse(HttpStatusCode.OK, new {
        decodedString = WebUtility.HtmlDecode($"{data.encodedString}")
    });
}

 

Input sample:

{
    "encodedString": "A &amp; B &lt; C"
}

 

Output sample:

 

{
    "decodedString":"A & B < C"
}

Regards,

Yoshihiro Kawabata