diff options
author | Deepak Bhole <[email protected]> | 2010-12-08 16:08:35 -0500 |
---|---|---|
committer | Deepak Bhole <[email protected]> | 2010-12-08 16:08:35 -0500 |
commit | e9689c098bd56cffb72820a511e41e89c96ce0eb (patch) | |
tree | 9c409f6ffdfd6fcb96e50f70973355025dcb134f /plugin/icedteanp/java | |
parent | 8975e54d6f5460b3ae3e09b96de025f911d2b7b4 (diff) |
PR597: Fix special character handling for applet tags
Diffstat (limited to 'plugin/icedteanp/java')
-rw-r--r-- | plugin/icedteanp/java/sun/applet/PluginAppletViewer.java | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java index f895361..2b9b0c3 100644 --- a/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java +++ b/plugin/icedteanp/java/sun/applet/PluginAppletViewer.java @@ -514,14 +514,6 @@ public class PluginAppletViewer extends XEmbeddedFrame UrlUtil.decode(message.substring("tag".length() + 1, spaceLocation)); String tag = message.substring(spaceLocation + 1); - // Decode the tag - tag = tag.replace(">", ">"); - tag = tag.replace("<", "<"); - tag = tag.replace("&", "&"); - tag = tag.replace(" ", "\n"); - tag = tag.replace(" ", "\r"); - tag = tag.replace(""", "\""); - PluginDebug.debug("Handle = " + handle + "\n" + "Width = " + width + "\n" + "Height = " + height + "\n" + @@ -1454,6 +1446,24 @@ public class PluginAppletViewer extends XEmbeddedFrame } /** + * Decodes the string (converts html escapes into proper characters) + * + * @param toDecode The string to decode + * @return The decoded string + */ + public static String decodeString(String toDecode) { + + toDecode = toDecode.replace(">", ">"); + toDecode = toDecode.replace("<", "<"); + toDecode = toDecode.replace("&", "&"); + toDecode = toDecode.replace(" ", "\n"); + toDecode = toDecode.replace(" ", "\r"); + toDecode = toDecode.replace(""", "\""); + + return toDecode; + } + + /** * System parameters. */ static Hashtable<String, String> systemParam = new Hashtable<String, String>(); @@ -1752,7 +1762,7 @@ public class PluginAppletViewer extends XEmbeddedFrame Hashtable<String, String> atts = new Hashtable<String, String>(); skipSpace(c, in); while (c[0] >= 0 && c[0] != '>') { - String att = scanIdentifier(c, in); + String att = decodeString(scanIdentifier(c, in)); String val = ""; skipSpace(c, in); if (c[0] == '=') { @@ -1775,7 +1785,7 @@ public class PluginAppletViewer extends XEmbeddedFrame c[0] = in.read(); } skipSpace(c, in); - val = buf.toString(); + val = decodeString(buf.toString()); } PluginDebug.debug("PUT " + att + " = '" + val + "'"); |