Commit Graph

3 Commits

Author SHA1 Message Date
Harvey Williams
13f76d2af9 Updated ReplaceLineBreaksForHtml to include \r
I was surprised when this method did not replace a `\r` character with an HTML break. I have updated it to not only replace `\n`, but also `\r\n` and just `\r`.

I think these cases should be considered because of [this SO thread](https://stackoverflow.com/questions/4824621/is-a-new-line-n-or-r-n).

The updated code will not replace `\n\r` with one break but with two.

I used [this SO answer](https://stackoverflow.com/a/8196219/2963111) to update the method.

```
[TestMethod]
public void ReplaceLineBreaksForHtmlTest()
{
    var result = "foo\rbar\nbaz\r\nbiff\n\r".ReplaceLineBreaksForHtml();

    Assert.AreEqual(result, "foo<br />\rbar<br />\nbaz<br />\r\nbiff<br />\n<br />\r");
}
```
2017-08-11 11:42:35 +01:00
Lotte Pitcher
c8b23195f6 When truncating if the last characters was the first half of a two word unicode character, also include the second half to avoid YSOD 2016-11-03 14:30:38 +00:00
Shannon
c760a7c50d Merge branch 'dev-v7-7.3.0-UmbHelperInterfaces' of https://github.com/Shazwazza/Umbraco-CMS into Shazwazza-dev-v7-7.3.0-UmbHelperInterfaces
Conflicts:
	src/Umbraco.Web/Umbraco.Web.csproj
2015-02-18 17:14:55 +01:00