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

Data.JSString.length does not behave correctly with surrogates #115

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"
      len1 = JSString.foldr (\_ -> (+ 1)) 0 txt -- 1
      len2 = JSString.length txt -- 2
  print $ len1 == len2 -- False
luite commented 5 years ago

thanks for the fix