Skip to content

Preserve non-ASCII input in form2json forms#1464

Merged
ysangkok merged 1 commit intohaskell:masterfrom
spencerjanssen:unicode-username-1339
Feb 18, 2026
Merged

Preserve non-ASCII input in form2json forms#1464
ysangkok merged 1 commit intohaskell:masterfrom
spencerjanssen:unicode-username-1339

Conversation

@spencerjanssen
Copy link
Contributor

Notably fixes an issue in the contact update form where names with non-ASCII characters were mangled.

Fixes #1339

Notably fixes an issue in the contact update form where names with
non-ASCII characters were mangled.

Fixes haskell#1339
parseJVal s = JSON.decode (BS8.pack s)
parseJVal s | [(str,"")] <- reads (T.unpack s) = Just (JSON.String (T.pack str))
parseJVal s | [(n, "")] <- reads (T.unpack s) = Just (JSON.Number (fromIntegral (n :: Int)))
parseJVal s = JSON.decodeStrict (encodeUtf8 s)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this last case we've gone from ByteString to Text and back to ByteString. Redundant, but harmless and simplifies the surrounding code.

@ysangkok ysangkok merged commit 812ab5d into haskell:master Feb 18, 2026
12 checks passed
@ysangkok
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

User name may be mangled if not ASCII

2 participants

Comments