ghcjs / ghcjs-base

base library for GHCJS for JavaScript interaction and marshalling, used by higher level libraries like JSC
MIT License
45 stars 67 forks source link

JSString does not handle surrogates correctly #113

Closed luigy closed 5 years ago

luigy commented 6 years ago
{-# LANGUAGE OverloadedStrings #-}
import qualified Data.JSString as JSString

main :: IO ()
main = do
  let txt = "\915929"
  case JSString.unsnoc txt of
    Nothing -> return ()
    Just (a, b) -> do
      let txt' = a <> JSString.singleton b
      putStrLn $ show txt' <> " == " <> show txt -- "\897497" == "\915929"
      print $ txt' == txt -- False
luite commented 5 years ago

thanks for the fix