Skip to content

Commit 76e6d62

Browse files
Use shared messages in HtmlInputStreamReader
This change just updates HtmlInputStreamReader to use shared message strings from the Encoding class for some of its error messages.
1 parent 0cfe6d2 commit 76e6d62

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/nu/validator/htmlparser/io/HtmlInputStreamReader.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ public HtmlInputStreamReader(InputStream inputStream,
139139
if (encoding == null) {
140140
declared = false;
141141
} else if (encoding != Encoding.UTF8) {
142-
err("Legacy encoding \u201C"
143-
+ encoding.getCanonName()
144-
+ "\u201D used. Documents must use UTF-8.");
142+
err(Encoding.msgLegacyEncoding(encoding.getCanonName()));
145143
}
146144
if (encoding == null
147145
&& (heuristics == Heuristics.CHARDET || heuristics == Heuristics.ALL)) {
@@ -157,7 +155,8 @@ public HtmlInputStreamReader(InputStream inputStream,
157155
encoding = Encoding.WINDOWS1252;
158156
}
159157
if (!declared) {
160-
err("The character encoding was not declared. Proceeding using \u201C" + encoding.getCanonName() + "\u201D.");
158+
err("The character encoding was not declared. Proceeding using"
159+
+ " \u201C" + encoding.getCanonName() + "\u201D.");
161160
}
162161
if (driver != null) {
163162
driver.setEncoding(encoding, Confidence.TENTATIVE);
@@ -168,9 +167,7 @@ public HtmlInputStreamReader(InputStream inputStream,
168167
driver.setEncoding(Encoding.UTF8, Confidence.CERTAIN);
169168
}
170169
} else {
171-
err("Legacy encoding \u201C"
172-
+ encoding.getCanonName()
173-
+ "\u201D used. Documents must use UTF-8.");
170+
err(Encoding.msgLegacyEncoding(encoding.getCanonName()));
174171
if (driver != null) {
175172
driver.setEncoding(Encoding.UTF16, Confidence.CERTAIN);
176173
}

0 commit comments

Comments
 (0)