Skip to content

Commit 0023390

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

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,22 +163,20 @@ protected boolean tryCharset(String encoding) throws SAXException {
163163
try {
164164
if ("utf-16be".equals(encoding) || "utf-16le".equals(encoding)) {
165165
this.characterEncoding = Encoding.UTF8;
166-
err("The internal character encoding declaration specified \u201C" + encoding + "\u201D which is not a rough superset of ASCII. Using \u201CUTF-8\u201D instead.");
166+
err(Encoding.msgIgnoredCharset(encoding, "utf-8"));
167167
return true;
168168
} else {
169169
Encoding cs = Encoding.forName(encoding);
170170
String canonName = cs.getCanonName();
171171
if (!cs.getCanonName().equals(encoding)) {
172172
err(Encoding.msgNotCanonicalName(encoding, canonName));
173173
this.characterEncoding = cs;
174-
} else {
175-
warn("Using \u201C" + actual.getCanonName() + "\u201D instead of the declared encoding \u201C" + encoding + "\u201D.");
176-
this.characterEncoding = actual;
177174
}
178175
return true;
179176
}
180177
} catch (UnsupportedCharsetException e) {
181-
err("Unsupported character encoding name: \u201C" + encoding + "\u201D. Will continue sniffing.");
178+
err(Encoding.msgBadInternalCharset(encoding)
179+
+ " Will continue sniffing.");
182180
}
183181
return false;
184182
}

0 commit comments

Comments
 (0)