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

fix: re:run does not work with unicode char list #297

Merged
merged 1 commit into from
Jul 3, 2024

Conversation

zmstone
Copy link
Member

@zmstone zmstone commented Jul 3, 2024

No description provided.

@zmstone zmstone merged commit fc0451c into emqx:master Jul 3, 2024
3 checks passed
@zmstone zmstone deleted the 0703-fix-re-run-on-utf8-str branch July 3, 2024 20:38
@zmstone
Copy link
Member Author

zmstone commented Jul 3, 2024

thanks for the review.
force pushed tag 0.43.1

@@ -1352,6 +1352,9 @@ default_map_key_name_validator(Name) ->
end
end.

re_run(Str, Pattern) ->
re:run(unicode:characters_to_binary(Str, utf8), Pattern).
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit. I think the correct way is actually re:run(Str, Pattern, [unicode]). Otherwise the risk is re consuming half of the (encoded) codepoint somewhere, because it still thinks that one byte = one character. Should be okay with current ?MAP_KEY_RE but not too future-proof.

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.

3 participants