Skip to content

escaping new lines and tabs #3

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

Merged
merged 3 commits into from
Apr 8, 2025
Merged

escaping new lines and tabs #3

merged 3 commits into from
Apr 8, 2025

Conversation

msuess23
Copy link
Contributor

@msuess23 msuess23 commented Apr 7, 2025

No description provided.

@msuess23 msuess23 requested a review from Lutzifer April 7, 2025 14:22
Comment on lines 28 to 30
var finalXmlString = xmlDocument.prettyPrinted

finalXmlString = finalXmlString.replacingOccurrences(of: "&#", with: "&#")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var finalXmlString = xmlDocument.prettyPrinted
finalXmlString = finalXmlString.replacingOccurrences(of: "&#", with: "&#")
let xmlString = xmlDocument.prettyPrinted
.replacingOccurrences(of: "&#", with: "&#")

Comment on lines 18 to 22
//.replacingOccurrences(of: "%%", with: "%")
//.replacingOccurrences(of: "«", with: "«")
//.replacingOccurrences(of: "»", with: "»")
//.replacingOccurrences(of: "á", with: "á")
//.replacingOccurrences(of: "é", with: "é")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//.replacingOccurrences(of: "%%", with: "%")
//.replacingOccurrences(of: "«", with: "«")
//.replacingOccurrences(of: "»", with: "»")
//.replacingOccurrences(of: "á", with: "á")
//.replacingOccurrences(of: "é", with: "é")

Comment on lines 37 to 41
let element = XMLElement(name: "string")
let cleaned = Self.cleanupValueForAndroid(value)
let textNode = XMLNode(kind: .text)
textNode.stringValue = cleaned
element.addChild(textNode)
Copy link
Member

Choose a reason for hiding this comment

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

why was this necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was my first approach. I had tried to prevent XMLElement from interpreting the string in any way and simply write what is in the source code of the .xcstrings directly (incl. ‘\n’ etc.) into the XML. Later I did the variant with the escaping and apparently forgot to remove the old code. At least I think that's how it was.

Copy link
Member

@Lutzifer Lutzifer left a comment

Choose a reason for hiding this comment

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

please undo the indentation changes and have a look at the comments

@Lutzifer Lutzifer merged commit 579f3a4 into main Apr 8, 2025
@msuess23 msuess23 deleted the escaping branch April 8, 2025 10:07
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.

2 participants