diff options
Diffstat (limited to 'sources/ch/epfl/lamp/util/HTMLPrinter.java')
-rw-r--r-- | sources/ch/epfl/lamp/util/HTMLPrinter.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sources/ch/epfl/lamp/util/HTMLPrinter.java b/sources/ch/epfl/lamp/util/HTMLPrinter.java index 04662bb910..6a1bd3dbe3 100644 --- a/sources/ch/epfl/lamp/util/HTMLPrinter.java +++ b/sources/ch/epfl/lamp/util/HTMLPrinter.java @@ -28,8 +28,10 @@ public class HTMLPrinter { /* * The characters which must be HTML encoded */ - private static final Character LT = new Character('<'); - private static final Character GT = new Character('>'); + private static final Character AMP = new Character('&'); + private static final Character GT = new Character('>'); + private static final Character LT = new Character('<'); + private static final Character QUOT = new Character('"'); //######################################################################## // Private Fields @@ -112,8 +114,10 @@ public class HTMLPrinter { * @param ch */ public static String encode(Character ch) { - if (LT.compareTo(ch) == 0) return "<"; - else if (GT.compareTo(ch) == 0) return ">"; + if (AMP.compareTo(ch) == 0) return "&"; + else if (GT.compareTo(ch) == 0) return ">"; + else if (LT.compareTo(ch) == 0) return "<"; + else if (QUOT.compareTo(ch) == 0) return """; else return ch.toString(); } |