diff --git a/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapper.java b/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapper.java
index 92eeda2d07131f82afefdcae6e1c22e57acf359d..373aeb63518fb78bf34bbed5aa2b62e7ff8a9335 100644
--- a/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapper.java
+++ b/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapper.java
@@ -72,7 +72,6 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 	private boolean enableTextmarking;
 	private boolean adjusteightAutomatically;
 	
-	private String g_encoding;
 	private String jsEncoding;
 	private String contentEncoding;
 
@@ -93,7 +92,6 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 	}
 	
 	public IFrameDeliveryMapper(VFSItem rootDir, boolean rawContent, boolean enableTextmarking, boolean adjusteightAutomatically,
-			String g_encoding, String jsEncoding, String contentEncoding,
 			String frameId, String customCssURL, String themeBaseUri, String customHeaderContent) {
 		
 		this.rootDir = rootDir;
@@ -102,10 +100,6 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 		this.enableTextmarking = enableTextmarking;
 		this.adjusteightAutomatically = adjusteightAutomatically;
 		
-		this.g_encoding = g_encoding;
-		this.jsEncoding = jsEncoding;
-		this.contentEncoding = contentEncoding;
-		
 		this.frameId = frameId;
 		this.customCssURL = customCssURL;
 		this.themeBaseUri = themeBaseUri;
@@ -121,7 +115,7 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 			}
 			openolatCss = config.getOpenolatCss();
 			if(config.getContentEncoding() != null) {
-				g_encoding = config.getContentEncoding();
+				contentEncoding = config.getContentEncoding();
 			}
 			if(config.getJavascriptEncoding() != null) {
 				jsEncoding = config.getJavascriptEncoding();
@@ -202,13 +196,16 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 			if (path.toLowerCase().lastIndexOf(FILE_SUFFIX_HTM) >= (path.length()-4)) {
 				// set the http content-type and the encoding
 				Page page = loadPageWithGuess(vfsLeaf);
-				g_encoding = page.getEncoding();
+				String pageEncoding = page.getEncoding();
 				if (page.isUseLoadedPageString()) {
-					mr = prepareMediaResource(httpRequest, page.getPage(), g_encoding, page.getContentType(), isPopUp);
+					mr = prepareMediaResource(httpRequest, page.getPage(), pageEncoding, page.getContentType(), isPopUp);
 				} else {
 					// found a new charset other than iso-8859-1, load string with proper encoding
-					String content = FileUtils.load(vfsLeaf.getInputStream(), g_encoding);
-					mr = prepareMediaResource(httpRequest, content, g_encoding, page.getContentType(), isPopUp);
+					String content = FileUtils.load(vfsLeaf.getInputStream(), pageEncoding);
+					mr = prepareMediaResource(httpRequest, content, pageEncoding, page.getContentType(), isPopUp);
+				}
+				if(contentEncoding == null) {
+					contentEncoding = pageEncoding;
 				}
 			} else if (path.endsWith(FILE_SUFFIX_JS)) { // a javascript library
 				VFSMediaResource vmr = new VFSMediaResource(vfsLeaf);
@@ -218,8 +215,11 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 				// together with the mime-type, which is wrong.
 				// so we assume the .js file has the same encoding as the html file
 				// that loads the .js file
-				if (jsEncoding != null) vmr.setEncoding(jsEncoding);
-				else if (g_encoding != null) vmr.setEncoding(g_encoding);
+				if (jsEncoding != null) {
+					vmr.setEncoding(jsEncoding);
+				} else if (contentEncoding != null) {
+					vmr.setEncoding(contentEncoding);
+				}
 				mr = vmr;
 			} else {
 				// binary data: not .html, not .htm, not .js -> treated as is
@@ -505,7 +505,7 @@ public class IFrameDeliveryMapper implements Mapper, Serializable {
 		return cType;
 	}
 	
-	private String guessEncoding(String content) {
+	protected String guessEncoding(String content) {
 		Matcher m = PATTERN_ENCTYPE.matcher(content);
 		if (m.find()) {
 			// use found char set
diff --git a/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java b/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java
index b3ce2bcf8cf14a873f792c4d85c9e3d3f11760d7..1293b6cfc182b6cd5af422e5edb59eb8f197d2ab 100644
--- a/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java
+++ b/src/main/java/org/olat/core/gui/control/generic/iframe/IFrameDisplayController.java
@@ -157,7 +157,6 @@ public class IFrameDisplayController extends BasicController implements GenericE
 		//TODO:gs may use the same contentMapper if users clicks again on the same singlePage, now each time a new Mapper gets created and 
 		//therefore the browser can not reuse the cached elements
 		contentMapper = new IFrameDeliveryMapper(rootDir, false, enableTextmarking, adjusteightAutomatically,
-				null /*g_encoding*/, null /*jsEncoding*/, null /*contentEncoding*/,
 				frameId, null /*customCssURL*/, themeBaseUri, null /*customHeaderContent*/);
 		contentMapper.setDeliveryOptions(options);
 
diff --git a/src/test/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapperTest.java b/src/test/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapperTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..fb76c4735acf487a115ea49a4654de9969e64f5d
--- /dev/null
+++ b/src/test/java/org/olat/core/gui/control/generic/iframe/IFrameDeliveryMapperTest.java
@@ -0,0 +1,43 @@
+/**
+ * <a href="http://www.openolat.org">
+ * OpenOLAT - Online Learning and Training</a><br>
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); <br>
+ * you may not use this file except in compliance with the License.<br>
+ * You may obtain a copy of the License at the
+ * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
+ * <p>
+ * Unless required by applicable law or agreed to in writing,<br>
+ * software distributed under the License is distributed on an "AS IS" BASIS, <br>
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
+ * See the License for the specific language governing permissions and <br>
+ * limitations under the License.
+ * <p>
+ * Initial code contributed and copyrighted by<br>
+ * frentix GmbH, http://www.frentix.com
+ * <p>
+ */
+package org.olat.core.gui.control.generic.iframe;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+/**
+ * 
+ * Initial date: 03.02.2014<br>
+ * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
+ *
+ */
+public class IFrameDeliveryMapperTest {
+	
+	@Test
+	public void testPatternRegex() {
+		IFrameDeliveryMapper mapper = new IFrameDeliveryMapper();
+		String encoding1 = mapper.guessEncoding("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">");
+		Assert.assertEquals("utf-8", encoding1);
+		
+		String encoding2 = mapper.guessEncoding("<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>");
+		Assert.assertEquals("UTF-8", encoding2);
+	}
+}
diff --git a/src/test/java/org/olat/test/AllTestsJunit4.java b/src/test/java/org/olat/test/AllTestsJunit4.java
index 7235870dcb111167c92d0d9a3a765b8787b4a0da..b35ade1683aa6fe0524cc4357636f1f734ca150b 100644
--- a/src/test/java/org/olat/test/AllTestsJunit4.java
+++ b/src/test/java/org/olat/test/AllTestsJunit4.java
@@ -66,6 +66,7 @@ import org.junit.runners.Suite;
 	org.olat.core.id.context.HistoryManagerTest.class,
 	org.olat.core.id.IdentityEnvironmentTest.class,
 	org.olat.core.gui.render.VelocityTemplateTest.class,
+	org.olat.core.gui.control.generic.iframe.IFrameDeliveryMapperTest.class,
 	org.olat.note.NoteTest.class,//ok
 	org.olat.user.UserPropertiesPerformanceTest.class,//ok
 	org.olat.user.EmailCheckPerformanceTest.class,//fail