Skip to content

Commit 0e56d73

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 f9b3796 commit 0e56d73

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
@@ -132,9 +132,7 @@ public HtmlInputStreamReader(InputStream inputStream,
132132
if (encoding == null) {
133133
declared = false;
134134
} else if (encoding != Encoding.UTF8) {
135-
err("Legacy encoding \u201C"
136-
+ encoding.getCanonName()
137-
+ "\u201D used. Documents must use UTF-8.");
135+
err(Encoding.msgLegacyEncoding(encoding.getCanonName()));
138136
}
139137
if (encoding == null
140138
&& (heuristics == Heuristics.CHARDET || heuristics == Heuristics.ALL)) {
@@ -150,7 +148,8 @@ public HtmlInputStreamReader(InputStream inputStream,
150148
encoding = Encoding.WINDOWS1252;
151149
}
152150
if (!declared) {
153-
err("The character encoding was not declared. Proceeding using \u201C" + encoding.getCanonName() + "\u201D.");
151+
err("The character encoding was not declared. Proceeding using"
152+
+ " \u201C" + encoding.getCanonName() + "\u201D.");
154153
}
155154
if (driver != null) {
156155
driver.setEncoding(encoding, Confidence.TENTATIVE);
@@ -161,9 +160,7 @@ public HtmlInputStreamReader(InputStream inputStream,
161160
driver.setEncoding(Encoding.UTF8, Confidence.CERTAIN);
162161
}
163162
} else {
164-
err("Legacy encoding \u201C"
165-
+ encoding.getCanonName()
166-
+ "\u201D used. Documents must use UTF-8.");
163+
err(Encoding.msgLegacyEncoding(encoding.getCanonName()));
167164
if (driver != null) {
168165
driver.setEncoding(Encoding.UTF16, Confidence.CERTAIN);
169166
}

0 commit comments

Comments
 (0)