Closed jamesdbrock closed 2 years ago
Oh interesting, it appears this is actually the line at fault: https://github.com/purescript/purescript-enums/blob/170d959644eb99e0025f4ab2e38f5f132fd85fa4/src/Data/Enum.purs#L316-L318
It's using top
and bottom
for ints, not chars. I guess n >= toCharCode bottom && n <= toCharCode top
might work?
String.fromCharCode
just does (code) % 0x10000
on the code, so what you're seeing is 65900 % 0x10000 = 0x16C
.
I've opened an issue in purescript-enum
to track this. Should this issue be closed?
I think it’s reasonable it stays open until the upstream issue is addressed
Technically, we still need a release of that library and then a dependency update here.
PR ready for approval: #163.
fromCharCode
should returnNothing
if the code is out of the Basic Multilingual PlaneChar
range, right?https://github.com/purescript/purescript-strings/blob/157e372a23e4becd594d7e7bff6f372a6f63dd82/src/Data/Char.purs#L16
The
Bounded
instance forChar
says that “Characters fall within the Unicode range,” but theChar
says “guaranteed to contain one code unit.”