Backport r12684 from trunk: escape raw ampersands as part of entityize
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 26 Mar 2009 15:29:31 +0000 (15:29 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 26 Mar 2009 15:29:31 +0000 (15:29 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4@12685 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm

index e9bb29b..1d7895a 100644 (file)
@@ -1510,6 +1510,9 @@ sub entityize {
                $string = NFC($string);
        }
 
+       # Convert raw ampersands to ampersand entities
+       $string =~ s/&(?!\S+;)/&amp;/gso;
+
        $string =~ s/([\x{0080}-\x{fffd}])/sprintf('&#x%X;',ord($1))/sgoe;
        return $string;
 }