unit test shows StringEscapeUtils.escapeHtml/escapeHtml4 don't produce same results.
trying to upgrade commons-lang(2.6) to commons-lang3(3.9) and found parity-mismatch in escapeHtml/escapeHtml4 methods.
for (String s : Stream.generate(()-> RandomStringUtils.random(100)).limit(100).toArray(String[]::new)) {
String oldVersion =
org.apache.commons.lang.StringEscapeUtils.escapeHtml(s);
String newVersion =
org.apache.commons.lang3.StringEscapeUtils.escapeHtml4(s);
Assertions.assertEquals(oldVersion, newVersion);
}
i would have expected the commons-lang3 StringEscapeUtils.escapeHtml4() to produce the same results as commons-lang StringEscapeUtils.escapeHtml(). granted, this test is over the full unicode range but still...
org.opentest4j.AssertionFailedError:
Expected :靂ᬧ뒼뽼㞛⼁寺ǐ弬澳��ﮒᜑ揢䈤ꮚ耳ᣛ泐䪶��늁㠌鋊劂荃❊��단ꂎ櫼㔀䯼絹䲼뎱뽚템☉钆쪄൒䷗㪨��鑺巉Ὄ䱒헓꧿㡕퟼㦰▬䟀⨈ꕓ⇊삗Շ㘵ᐟ蚳��➺컏풎쬴徊풫ᶒ咼芸ᘞ记ᣎἪ꣏陘ґ耚䂊녊ᵙ雜
Actual :靂ᬧ뒼뽼㞛⼁寺ǐ弬澳ﮒᜑ揢䈤ꮚ耳ᣛ泐䪶늁㠌鋊劂荃❊단ꂎ櫼㔀䯼絹䲼뎱뽚템☉钆쪄䷗㪨鑺巉Ὄ䱒헓㡕㦰▬䟀⨈ꕓ⇊삗Շ㘵ᐟ蚳➺컏풎쬴徊풫ᶒ咼芸ᘞ记ᣎἪ꣏陘ґ耚䂊녊ᵙ雜
are these chars not escaped in HTML4 any longer? doesn't that depend on your encoding? is there a way to force commons-lang3 to behave like commons-lang in this regard?