Add a `isWellFormed` function? · Issue #156 · purescript/purescript-strings · GitHub
Skip to content

Add a isWellFormed function? #156

Open

Description

@chtenb

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.

Activity

  1. michaelficarra commented on Jun 29, 2022

    @michaelficarra
    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
  2. michaelficarra commented on Jun 29, 2022

    @michaelficarra
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions