diff --git a/CHANGELOG.md b/CHANGELOG.md index 86ce55fe..7d76414b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Breaking changes: New features: Bugfixes: +- Fixed `encode` not replacing all instances of special characters (#254 by @jy14898) ## [v2021-08-25.1](https://github.com/purescript/trypurescript/releases/tag/v2021-08-25.1) - 2021-08-25 diff --git a/staging/src/TryPureScript.purs b/staging/src/TryPureScript.purs index 5e873c6b..92e24132 100644 --- a/staging/src/TryPureScript.purs +++ b/staging/src/TryPureScript.purs @@ -20,7 +20,7 @@ module TryPureScript import Prelude import Data.Foldable (class Foldable, foldMap) import Data.String (joinWith) -import Data.String.Common (replace) +import Data.String.Common (replaceAll) import Data.String.Pattern (Pattern(..), Replacement(..)) import Effect (Effect) @@ -28,10 +28,10 @@ foreign import setInnerHTML :: String -> Effect Unit encode :: String -> String encode = - replace (Pattern "<") (Replacement "<") - <<< replace (Pattern ">") (Replacement ">") - <<< replace (Pattern "&") (Replacement "&") - <<< replace (Pattern "\"") (Replacement """) + replaceAll (Pattern "<") (Replacement "<") + <<< replaceAll (Pattern ">") (Replacement ">") + <<< replaceAll (Pattern "&") (Replacement "&") + <<< replaceAll (Pattern "\"") (Replacement """) foreign import withConsoleImpl :: forall a