Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentCharsetDetector.java')
-rw-r--r--bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentCharsetDetector.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentCharsetDetector.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentCharsetDetector.java
new file mode 100644
index 0000000000..01f8808e0d
--- /dev/null
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/encoding/HTMLDocumentCharsetDetector.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wst.html.core.encoding;
+
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.wst.html.core.internal.contenttype.HTMLResourceEncodingDetector;
+import org.eclipse.wst.sse.core.document.DocumentReader;
+import org.eclipse.wst.sse.core.document.IDocumentCharsetDetector;
+
+/**
+ * This class parses beginning portion of HTML file to get the encoding value
+ * in a META tag. Example:
+ * <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+ *
+ * Note: even though, technically, a META tag must come in a <HEAD>tag, we
+ * don't check for that, under the assumption that whatever, or whereever, the
+ * the first <META>tag is, it is the one intended to be used by the user, and
+ * they may just be trying to repair the error. The HTML validator will tell
+ * them if its in the wrong location.
+ *
+ */
+public class HTMLDocumentCharsetDetector extends HTMLResourceEncodingDetector implements IDocumentCharsetDetector {
+
+
+ public HTMLDocumentCharsetDetector() {
+ super();
+ }
+
+ public void set(IDocument document) {
+ set(new DocumentReader(document, 0));
+
+
+ }
+} \ No newline at end of file

Back to the top