Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a isWellFormed function? #156

Open
chtenb opened this issue Feb 21, 2022 · 2 comments
Open

Add a isWellFormed function? #156

chtenb opened this issue Feb 21, 2022 · 2 comments

Comments

@chtenb
Copy link

chtenb commented Feb 21, 2022

Could we provide a function that checks if a string is wellformed w.r.t. its encoding? In the JS backend this would be a check if there are lone surrogates present, in other backends this may be a different check. This would allow one to check if a string is well formed, after which one doesn't have to deal with invalid encoded string situations.

@michaelficarra
Copy link
Contributor

Maybe a better API would return either the already-well-formed string or a new string derived by an implementation-defined transformation process (such as using replacement characters) on the input to ensure it is well-formed.

toWellFormed :: String -> Either String String

@michaelficarra
Copy link
Contributor

Also see purescript/purescript#3662 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants