在 href link 被包含在显示的 hyperlink 之后,非中断 space

Non breaking space after an href link is being included in the displayed hyperlink

我在从保存的模板向用户发送电子邮件时遇到问题。在此模板中,有不间断的 spaces 来保留预期的格式,并且没有形成 link 或发送电子邮件的问题。

然而,当标签显示在他们首选的邮件服务上时,似乎在通过邮件服务器后,一些用户看到了格式错误的超文本 link。

例如, 这就是原始 link 在我们发送的消息中的样子,

Log in to <a href=\"https://website"\>https://website</a>&nbsp;to

这就是用户报告他们在消息中看到 link

的方式

https://website to

而不是

https://website

在将测试电子邮件发送给自己后,我能够从中提取原始消息,并且没有发现编码有任何问题。有人处理过这个吗?

我不确定尝试删除字符并用常规 space 替换它是否更好?或者是否有其他方法可以解决这个问题?

您可以尝试用 <span> 包裹 link,这可能会解决问题...请注意,我已将转义双引号 \" 替换为单引号 '

<!DOCTYPE html>
<html>
<body>
<label>Wrapped the link with a span</label>
<div>
    Log in to <span><a href='https://website'>https://website</a></span>&nbsp;to
</div>
</body>
</html>