[237567] [document] html editor mishandles encoding - it may destroy file
diff --git a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/EncodingGuesser.java b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/EncodingGuesser.java
index 7656fba..bdbb65a 100644
--- a/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/EncodingGuesser.java
+++ b/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contenttype/EncodingGuesser.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2001, 2011 IBM Corporation and others.
+ * Copyright (c) 2001, 2012 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
@@ -12,6 +12,8 @@
  *******************************************************************************/
 package org.eclipse.wst.html.core.internal.contenttype;
 
+
+
 /**
  * 
  * This is ported from PageDesigner's hpbcom/Kanji.cpp's
@@ -68,6 +70,8 @@
 	 */
 	private static final int UNKNOWN = -1; // Unknown
 
+	private static final boolean IS_GUESSING_ENABLED = isGuessingEnabled();
+
 	/**
 	 * @return java.lang.String
 	 * @param code
@@ -98,12 +102,20 @@
 	}
 
 	public static boolean canGuess() {
+		if (!IS_GUESSING_ENABLED) {
+			return false;
+		}
 		// Currently, only Japanese is supported.
 		String system_ctype = java.util.Locale.getDefault().getLanguage();
 		String jp_ctype = java.util.Locale.JAPANESE.getLanguage();
 		return system_ctype.compareTo(jp_ctype) == 0;
 	}
 
+	private static boolean isGuessingEnabled() {
+		String value = System.getProperty("org.eclipse.wst.sse.html.encoding.guess");
+		return value == null || Boolean.valueOf(value).booleanValue();
+	}
+
 	/**
 	 * Return guessed Java Encoding name target: bytes to be inspected length:
 	 * length of target
@@ -135,8 +147,12 @@
 				case EUC_JP :
 					code = EUC_JP;
 					break;
-				default :
+				case SHIFT_JIS :
+				case SJIS_HALFKANA :
 					code = SHIFT_JIS;
+					break;
+				default :
+					return null;
 			}
 		}
 		return (convertToIANAEncodingName(code));