Implement escape and unescape - #108
Open
FikriMilano wants to merge 1 commit into
Open
Conversation
FikriMilano
force-pushed
the
escape-unescape
branch
from
August 1, 2026 03:29
9cafb9e to
416ed3a
Compare
jingtang10
requested changes
Aug 3, 2026
jingtang10
requested changes
Aug 4, 2026
Comment on lines
+406
to
+408
| } catch (_: Exception) { | ||
| return emptyList() | ||
| } |
Contributor
There was a problem hiding this comment.
oh sorry i missed this.. what's this for?
Member
Author
There was a problem hiding this comment.
malformed input can make unescaping throw, I've added test cases for it.
the spec doesn't say what to do there, so this returns empty instead of crashing
Contributor
There was a problem hiding this comment.
Hmmm interesting. Is there a more detailed exception type you can catch? I really don't like this very broad catch all...
FikriMilano
force-pushed
the
escape-unescape
branch
3 times, most recently
from
August 7, 2026 15:58
8516161 to
910d215
Compare
FikriMilano
force-pushed
the
escape-unescape
branch
from
August 7, 2026 17:12
910d215 to
31ae234
Compare
Member
Author
|
@jingtang10 this is ready. cleaned some of the implementations, redo the kdoc and comments, tests are more uniform |
jingtang10
approved these changes
Aug 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements string functions
escape(target)andunescape(target)for thehtmlandjsontargets (https://hl7.org/fhirpath/en/#escapetarget--string--string).html: escaping turns the special characters&,<,>,"and'into entities like&, and any character above 127 (accents, symbols, emoji) into a numeric entity likeé, as the spec recommends. Unescaping reverses all of these, including numeric entities in decimal and hex.json: escaping makes a string safe to put inside a JSON string, so"becomes\", a backslash becomes\\, and line breaks and similar characters become\n,\tand so on. Unescaping reverses all of these, including\uXXXXcodes.