Skip to content

Conversation

pcuenca
Copy link
Member

@pcuenca pcuenca commented Sep 12, 2025

The BOM is swallowed by JSONSerialization.jsonObject() because it thinks it signals the encoding in use. This workaround duplicates BOM sequences that follow a quote character.

Fixes #116
Fixes #88
Fixes ml-explore/mlx-swift-examples#50

The BOM is swallowed by JSONSerialization.jsonObject() because it thinks
it signals the encoding in use. This workaround duplicates BOM sequences
that follow a quote character.

Fixes #116
Fixes #88
Fixes ml-explore/mlx-swift-examples#50
@pcuenca pcuenca requested review from FL33TW00D and mattt September 12, 2025 14:57
Copy link
Collaborator

@FL33TW00D FL33TW00D left a comment

Choose a reason for hiding this comment

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

Not going to pretend I 100% understand why this is needed, but nothing looks untoward!

@pcuenca
Copy link
Member Author

pcuenca commented Sep 12, 2025

@FL33TW00D lol, it's essentially what you suggested here, only in a more hackish way - we duplicate the BOM rather than replacing it with something else and then undoing the replacement

@FL33TW00D
Copy link
Collaborator

@FL33TW00D lol, it's essentially what you suggested here, only in a more hackish way - we duplicate the BOM rather than replacing it with something else and then undoing the replacement

Damn completely forgot about that! Much better approach to duplicate than add a random marker. LGTM

@pcuenca pcuenca merged commit f6ca318 into main Sep 12, 2025
2 checks passed
@pcuenca pcuenca deleted the bom-workaround branch September 12, 2025 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants