Skip to content

Commit 6413b44

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 eab3602 commit 6413b44

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
@@ -560,6 +560,31 @@ public Encoding getActualHtmlEncoding() {
560560
return actualHtmlEncoding;
561561
}
562562

563+
protected static String msgLegacyEncoding(String name) {
564+
return "Legacy encoding \u201C" + name + "\u201D used. Documents must"
565+
+ " use UTF-8.";
566+
}
567+
568+
protected static String msgIgnoredCharset(String ignored, String name) {
569+
return "Internal encoding declaration specified \u201C" + ignored
570+
+ "\u201D. Continuing as if the encoding had been \u201C"
571+
+ name + "\u201D.";
572+
}
573+
protected static String msgNotCanonicalName(String label, String name) {
574+
return "The encoding \u201C" + label + "\u201D is not the canonical"
575+
+ " name of the character encoding in use. The canonical name"
576+
+ " is \u201C" + name + "\u201D. (Charmod C024)";
577+
}
578+
579+
protected static String msgBadInternalCharset(String internalCharset) {
580+
return "Internal encoding declaration named an unsupported character"
581+
+ " encoding \u201C" + internalCharset + "\u201D.";
582+
}
583+
584+
protected static String msgBadEncoding(String name) {
585+
return "Unsupported character encoding name: \u201C" + name + "\u201D.";
586+
}
587+
563588
public static void main(String[] args) {
564589
for (Map.Entry<String, Encoding> entry : encodingByLabel.entrySet()) {
565590
String name = entry.getKey();

0 commit comments

Comments
 (0)