Skip to content

Commit 6462d3f

Browse files
Add shared error-message strings to Encoding class
This change adds some error-message strings to the Encoding class — for shared used by the htmlparser.io.Driver and htmlparser.io.MetaSniffer classes, which need to emit the same error messages in a number of cases.
1 parent 03954fb commit 6462d3f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,31 @@ public Encoding getActualHtmlEncoding() {
322322
return actualHtmlEncoding;
323323
}
324324

325+
protected static String msgLegacyEncoding(String name) {
326+
return "Legacy encoding \u201C" + name + "\u201D used. Documents must"
327+
+ " use UTF-8.";
328+
}
329+
330+
protected static String msgIgnoredCharset(String ignored, String name) {
331+
return "Internal encoding declaration specified \u201C" + ignored
332+
+ "\u201D. Continuing as if the encoding had been \u201C"
333+
+ name + "\u201D.";
334+
}
335+
protected static String msgNotCanonicalName(String label, String name) {
336+
return "The encoding \u201C" + label + "\u201D is not the canonical"
337+
+ " name of the character encoding in use. The canonical name"
338+
+ " is \u201C" + name + "\u201D. (Charmod C024)";
339+
}
340+
341+
protected static String msgBadInternalCharset(String internalCharset) {
342+
return "Internal encoding declaration named an unsupported character"
343+
+ " encoding \u201C" + internalCharset + "\u201D.";
344+
}
345+
346+
protected static String msgBadEncoding(String name) {
347+
return "Unsupported character encoding name: \u201C" + name + "\u201D.";
348+
}
349+
325350
public static void main(String[] args) {
326351
for (Map.Entry<String, Encoding> entry : encodingByLabel.entrySet()) {
327352
String name = entry.getKey();

0 commit comments

Comments
 (0)