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

Escape single quotes in validation messages #898

Closed
sdurrenmatt opened this issue Nov 24, 2023 · 1 comment
Closed

Escape single quotes in validation messages #898

sdurrenmatt opened this issue Nov 24, 2023 · 1 comment

Comments

@sdurrenmatt
Copy link
Contributor

Validation messages that contain single quotes are not properly escaped, resulting in missing single quotes and uninterpreted format elements. For example, the French "pattern" validation message {0} ne correspond pas à l'expression régulière {1} with args $.foo and (foo)+ will result in $.foo ne correspond pas à lexpression régulière {1}.

See MessageFormat

Within a String, a pair of single quotes can be used to quote any arbitrary characters except single quotes. For example, pattern string "'{0}'" represents string "{0}", not a FormatElement. A single quote itself must be represented by doubled single quotes '' throughout a String. For example, pattern string "'{''}'" is interpreted as a sequence of '{ (start of quoting and a left curly brace), '' (a single quote), and }' (a right curly brace and end of quoting), not '{' and '}' (quoted left and right curly braces): representing string "{'}", not "{}".

Any unmatched quote is treated as closed at the end of the given pattern. For example, pattern string "'{0}" is treated as pattern "'{0}'".

sdurrenmatt pushed a commit to sdurrenmatt/json-schema-validator that referenced this issue Nov 24, 2023
sdurrenmatt pushed a commit to sdurrenmatt/json-schema-validator that referenced this issue Nov 24, 2023
sdurrenmatt added a commit to sdurrenmatt/json-schema-validator that referenced this issue Nov 24, 2023
sdurrenmatt added a commit to sdurrenmatt/json-schema-validator that referenced this issue Nov 24, 2023
sdurrenmatt added a commit to sdurrenmatt/json-schema-validator that referenced this issue Nov 24, 2023
@stevehu
Copy link
Contributor

stevehu commented Dec 3, 2023

PR is merged.

@stevehu stevehu closed this as completed Dec 3, 2023
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