HTML safe wrapping of long lines

前端 未结 2 1826
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-11 05:39

I\'m having problems sending HTML emails with long lines of text. The WYSIWYG editor (FCKEditor 2.5) used on the site keeps removing all the \\n characters on c

相关标签:
2条回答
  • 2020-12-11 05:54

    Following my comment, I'm posting this as I have been able to run a test.

    tidy::repairString shoud do the job just fine, better than any regex solution.

    $content = "<html>......</html>";
    $oTidy = new tidy();
    $content = $oTidy->repairString($content,
        array("show-errors" => 0, "show-warnings" => false),
        "utf8"
    );
    

    Adapt the Charset parameter (3rd) to your needs.

    The clean option is unneeded for this, I was wrong in my comment.

    0 讨论(0)
  • 2020-12-11 06:14

    If I understand everything correctly, you don't need to concern yourself with lines that don't contain HTML at all - these can be left to be handled by email clients.

    0 讨论(0)
提交回复
热议问题