我在数据库中有html编码的字符串,但许多字符实体不仅仅是标准&和<.像“和的实体—.不幸的是,我们需要将这些数据提供给基于闪存的rss阅读器,而flash不会读取这些实体,但它们会读取等效的unicode(ex “).
使用.Net 4.0,是否有任何实用方法可以将html编码的字符串转换为使用unicode编码的字符实体?
这是我需要的更好的例子.db有html字符串,如下所示:<p>John & Sarah went to see $ldquo;Scream 4$rdquo;.</p>我需要在rss/xml文档中输出的内容<description>是:<p>John &#38; Sarah went to see &#8220;Scream 4&#8221;.</p>
我正在使用XmlTextWriter从数据库记录创建xml文档,类似于此示例代码http://www.dotnettutorials.com/tutorials/advanced/rss-feed-asp-net-csharp.aspx
所以我需要将数据库中的html字符串中的所有字符实体替换为unicode等效,因为基于flash的rss阅读器无法识别最常见的任何实体&.
我周末在家里做了一些工作,并使用git将代码更改合并到我的办公室计算机(通过vpn连接),并发现了一些非常难看的合并问题.
首先,合并应该非常干净,因为星期五在办公室里已经完成了所有工作,我只在周六和周日对我的家用电脑进行了更改.但是,当我将更改提取到我的办公室计算机时,我最终遇到了大量的合并冲突.
我清理了合并冲突,但后来我发现许多文件(从我可以告诉我周末更改的任何文件)都有<<<<<<< HEAD" and ">>>>>>> D1/master整个文件.例如:
diff --git a/web/Web.Controller/Helpers/FormsAuthentication.cs b/web/Web.Controller/Helpers/FormsAuthentication.cs
index 8571f53..4a9c9fc 100644
-- a/web/Web.Controller/Helpers/FormsAuthentication.cs
++ b/web/Web.Controller/Helpers/FormsAuthentication.cs
@@ -10,7 +10,10 @@
/// </summary>
public class FormsAuthenticationUtility : IAuthenticationUtility
{
<<<<<<< HEAD
=======
>>>>>>> D1/master
#region IAuthentication Members
/// <summary>
Run Code Online (Sandbox Code Playgroud)
我能够kdiff通过与从我的家用计算机复制的源代码进行比较来修复代码,但这似乎完全搞砸了.
有什么想法发生了什么?
我正在使用magnific-popup来显示一个通过ajax获取内容的表单.这段代码工作正常:
<a href="/entry-form" class="ajax-popup-link">
<button class="green">Enter Now</button></a>
...
<script>
$('.ajax-popup-link').magnificPopup({
type: 'ajax'
});
</script>
Run Code Online (Sandbox Code Playgroud)
但根据HTML5规则,<button>标记不能位于<a>标记中.
所以我将html代码更改为:
<button class="green" href="/entry-form" class="ajax-popup-link">Enter Now</button>
Run Code Online (Sandbox Code Playgroud)
但是magnific-popup代码无法识别<button>元素上的href属性.
我该怎么做?