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

" in XML element may not always be escaping #187

Closed
owenzhao opened this issue Jun 1, 2020 · 1 comment · Fixed by #188
Closed

" in XML element may not always be escaping #187

owenzhao opened this issue Jun 1, 2020 · 1 comment · Fixed by #188
Labels
enhancement New feature or request

Comments

@owenzhao
Copy link
Collaborator

owenzhao commented Jun 1, 2020

In xliff exported by Xcode, most of the time there is a note element, like this

<note>Class = "NSTextFieldCell"; title = "Table View Cell"; ObjectID = "2Mq-0d-Xix";</note>

When decoded and encoded by XMLCoder, the "s in the element's value are escaping.

<note>Class = &quot;NSTextFieldCell&quot;; title = &quot;Table View Cell&quot;; ObjectID = &quot;2Mq-0d-Xix&quot;;</note>

Both are accepted by Xcode. Just the latter is not as clear as the prior in raw format for human reading.

@MaxDesiatov MaxDesiatov added the enhancement New feature or request label Jun 1, 2020
MaxDesiatov added a commit that referenced this issue Jun 1, 2020
Resolve #185.
Resolve #187.

Add new `charactersEscapedInAttributes` and `charactersEscapedInElements` properties on `XMLEncoder` that allow customizing how certain characters are escaped.
@MaxDesiatov
Copy link
Collaborator

With the new API in master you can do something like this:

let encoder = XMLEncoder()
encoder.charactersEscapedInElements = [
        ("&", "&amp;"),
        ("<", "&lt;"),
        (">", "&gt;"),
        ("'", "&apos;"),
    ]

This will disable the &quot; substitution, but preserve the rest of the default ones.

arjungupta0107 pushed a commit to salido/XMLCoder that referenced this issue Jun 26, 2020
Resolve CoreOffice#185.
Resolve CoreOffice#187.

Add new `charactersEscapedInAttributes` and `charactersEscapedInElements` properties on `XMLEncoder` that allow customizing how certain characters are escaped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants