从html移除`= \ n` [英] Remove `=\n` from html

查看:264
本文介绍了从html移除`= \ n`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个RoundCube插件,可将消息正文写入数据库,然后,我需要将数据解析到另一个表中.通过在RoundCube中使用某些功能,我可以删除所有html标记,并且</td>替换为'\ n',而</tr>替换为'\ n \ n'.这使我的数据解析变得非常轻松和强大.仅有一个缺点,即html数据被分解为固定行,并以=结尾,例如:

I have a RoundCube plugin that writes the message body to the database and after that I need to parse the data into another table. By using certain functions in RoundCube I am able to remove all html tags and a </td> is replaced by '\n' and </tr> is replaced by '\n\n'. This make the parsing of my data very easy and robust. There is only one drawback, the html data are broken into fix lines with an = at the end, e.g.:

<td valign=3D"bottom" style=3D"color:#444444;padding:5px 10px 5=
px 0px;font-size:12px;border-bottom:1px solid #eeeeee;"><b>Discount</b></td=
><td valign=3D"bottom" align=3D"right" style=3D"color:#444444;padding:5px 0=
px 5px 0px;font-size:12px;border-bottom:1px solid #eeeeee;text-align:right;=
"><b>Price after discount</b></td>

现在,</td=未被识别,因此折扣通过以下方式加入折扣后价格:折扣后折扣价格 \ n,而不是折扣 \ n 折扣后的价格 \ n.这贯穿了代码,确实给我带来了严重的问题.

Now, the </td='s are not getting recognised and therefore the Discount are joined to Price after discount in the following way DiscountPrice after discount\n, instead of Discount\n Price after discount\n. This is all the way through the code and are really causing me severe problems.

我试图删除=并破坏了类似的内容:

I tried to remove the = and break with things like:

$msg_body = str_replace('=', '', $msg_body);
$msg_body = str_replace('=\n', '', $msg_body);
$msg_body = str_replace('= ', '', $msg_body);

没有真正的成功.我不知道=号后是哪种换行符,是换行符还是段落换行符,并试图找出来,但是徒劳地看了RoundCube代码.删除html也没有向我显示任何内容.

with no real success. I do not know which type of break comes after the = sign, whether it is a line break or paragraph break and tried to find out, but in vain, even looked at the RoundCube code. Echoing out the html did not revealed anything to me as well.

我在这里将其作为一般的php和html问题发布,希望有人可以帮助我简单地删除这些=符号,然后神秘的(对我而言)中断,以便

I post this here as a general php and html question in the hope that someone can help me to simply remove these = sign and the mysterious (to me) breaks so that

</td=
>

成为

</td>

推荐答案

=XY表示法是(旧式但仍在使用!)带引号的可打印编码的一部分,该编码表示7位ASC中的8位ASCII字符串.代码集.所有> 127的字符均以=F3格式编码,这是该字符的十六进制表示形式.

The =XY notation is part of the (oldschool but still used!) quoted-printable encoding that represents a 8-bit ASCII string in 7-bit ASC codeset. All characters that are >127 are encoded in the form =F3, which is a hexadecimal representation of the character.

例如,在您的HTML标记中,如果仔细查看,则=会被编码为=3D.

For example in your HTML tags, the = is encoded as =3D if you take a closer look at it.

有关详细信息,请参见关于引用的可打印的维基百科

Read more at Wikipedia on quoted-printable

要将消息解码回普通HTML,必须应用 quoted_printable_decode() 到字符串.

To decode the message back to normal HTML, you must apply quoted_printable_decode() to the string.

$msg_body = quoted_printable_decode($msg_body);

这篇关于从html移除`= \ n`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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