简体   繁体   English

逻辑应用程序 - 以纯文本格式转换 HTML 符号

[英]Logic Apps - Converting HTML symbols in plain text

Fairly new to Logic Apps and not familiar with all the functions.逻辑应用程序的新手并且不熟悉所有功能。

I created a simple Logic App that will check an RSS feed every so often, loops every item it finds, takes only certain data (title, summary and URL link), paste them in an HTML table and then send an email with the outcome.我创建了一个简单的逻辑应用程序,它会经常检查 RSS 提要,循环它找到的每个项目,只获取某些数据(标题、摘要和 URL 链接),将它们粘贴到 HTML 表中,然后发送带有结果的电子邮件。 Sounds fairly simple, right?听起来相当简单,对吧?

The problem I'm facing is that the RSS feed contains certain HTML characters such as &我面临的问题是 RSS 提要包含某些 HTML 字符,例如& or '' , which will then appear in the email I receive. ,然后会出现在我收到的电子邮件中。 Is it possible to convert these in Logic Apps?是否可以在逻辑应用程序中转换这些?

Additionally, I've also noticed that some HTML character are "double encoded??"此外,我还注意到一些 HTML 字符是“双重编码的??” Basically if we had to look at <description>&amp;quot;Quando Romelu si mette in testa una cosa, di solito la ottiene. Ora, si sarebbe messo in testa l&amp;rsquo;Inter.</description>基本上,如果我们不得不看<description>&amp;quot;Quando Romelu si mette in testa una cosa, di solito la ottiene. Ora, si sarebbe messo in testa l&amp;rsquo;Inter.</description> <description>&amp;quot;Quando Romelu si mette in testa una cosa, di solito la ottiene. Ora, si sarebbe messo in testa l&amp;rsquo;Inter.</description> straight away you'd realise that the first &amp; <description>&amp;quot;Quando Romelu si mette in testa una cosa, di solito la ottiene. Ora, si sarebbe messo in testa l&amp;rsquo;Inter.</description>你会立刻意识到第一个&amp; is there for the quot;是在那里quot; that follows it.紧随其后。 So it's kind of expecting that first the &amp;所以有点期待&amp; is converted in an actual & to then form &quot;以实际的 & 转换为形式&quot; to be then converted to ", if it makes sense what I'm saying. I don't own the feed, or in any way control it. Wanted to get familiar with Logic Apps so I thought I'd start with some football news processing.然后转换为“,如果我说的有意义。我不拥有提要,也不以任何方式控制它。想熟悉逻辑应用程序,所以我想我会从一些足球新闻开始加工。

Here's a sample of one item(out of 20) in the RSS feed这是 RSS 提要中一项(共 20 个)的示例

<item>
  <guid>https://www.fcinternews.it/?action=read&amp;idnotizia=310797</guid>
  <pubDate>Wed, 19 Jun 2019 09:51:40 +0200</pubDate>
  <title>CdS - Il BVB vuole Pinamonti: valutazione schizzata oltre i 20 milioni </title>
  <link>https://www.fcinternews.it/rassegna/cds-il-bvb-vuole-pinamonti-valutazione-schizzata-oltre-i-20-milioni-310797</link>
  <description>Anche il Corriere dello Sport sottolinea la grande fila che si &amp;egrave; messa in attesa di buone nuove dall&amp;#39;Inter per Andrea Pinamonti, protogonista del Mondiale U-20.</description>
  <category>Rassegna</category>
  <enclosure url="https://net-storage.tccstatic.com/storage/fcinternews.it/img_notizie/thumb1/ec/ec620af4eeb01ebebbb662d7947a6700-85495-21a8fcf5fc9c392cfa4303d2753d5db6.jpeg" type="image/jpeg" length="9983"/>
</item>

There is the solution to use an Azure function to clean it up link有使用 Azure 函数清理链接的解决方案

However, as you are doing something like this I guess you can do replace actions and oh btw single quotation escapes suck.然而,当你在做这样的事情时,我想你可以做替换动作,哦顺便说一句,单引号转义很糟糕。 Use a variable to cheat it.使用变量来欺骗它。

replace(replace(replace(replace(item()['summary'],'&nbsp;',' '),'&amp;','& '),'&quot;','"'),'&#39;','')

replace(replace(replace(replace(item()['title'],'&nbsp;',' '),'&amp;','& '),'&quot;','"'),'&#39;',variables('EscapeSingleQuotation'))

流动

Result结果

html表格

Is this what you are looking for?这是你想要的?

Microsoft have included new connector called - Content Conversion . Microsoft 已包含称为- 内容转换的新连接器。
This converts HTML contents to plain string.这会将 HTML 内容转换为纯字符串。

This is available on Logic Apps, Power Automate, Power Apps.这在 Logic Apps、Power Automate、Power Apps 上可用。 But still on preview phase.但仍处于预览阶段。

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM