编码困难:&放大器;放大器;#163;显示代替£ [英] Encoding difficulties: £ displaying instead of £

查看:165
本文介绍了编码困难:&放大器;放大器;#163;显示代替£的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从SQL Server数据库到我的ASP.Net C#为基础的网站访问数据。这个数据是从关联公司收到包含&放大器;放大器;#163; 为£迹象。但是,当我显示标签这里面的数据,而不是£,它显示了&放大器;#163;

I am accessing data from an SQL Server database to my ASP.Net C# based website. This data is received from affiliate companies and contains £ for the £ sign. But when I display this data inside a label, instead of £ it shows £.

注:&放大器;放大器; 转换为&安培;

我知道这是一个字符编码的问题,我试图提供的字符编码​​为UTF-8,也是ISO-8859-1的标题。

I know it's a character encoding problem and I've tried to provide the character encoding as 'utf-8' and also 'ISO-8859-1' in the header.

我应该使用哪种字符编码来解决这个问题?

Which character encoding should I use to solve the problem?

推荐答案

这不是以找到正确的字符编码​​打开字节到文本的问题,它是如何文本已经连接codeD(或者说转义)

It's not a problem with finding the correct character encoding to turn the bytes into text, it's how the text has been encoded (or rather escaped).

问题是,该文本已经HTML EN codeD的两倍。第一次它把£&放大器;#163; ,第二次进入 &放大器;放大器;#163;

The problem is that the text has been HTML encoded twice. The first time it turns the £ into £, the second time into £.

因此​​,要纠正这个,你必须使用 HtmlDe code 办法扭转第二个步骤。

So, to correct this you have to use the HtmlDecode method to reverse the second step.

这篇关于编码困难:&放大器;放大器;#163;显示代替£的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆