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 linebreaks when importing strings #813

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

Chesyon
Copy link
Contributor

@Chesyon Chesyon commented Oct 10, 2024

Fixes #812. When exporting strings to a CSV, actual linebreaks are swapped for \n, as shown here:

wr.writerows([[x.replace("\n", "\\n")] for x in self._str.strings])

The issue arises from the fact that this is not undone when importing, meaning the linebreaks stay as \n instead of actual linebreaks. This can be undone by adding a replace("\\n", "\n") to the code relevant to importing, causing the new code to look like this:

strings.append(row[0].replace("\\n", "\n"))

This should cause linebreaks to be imported properly instead of as \n.

I'm unable to build SkyTemple to see if this works myself, but I'm hoping my logic makes sense.

@theCapypara theCapypara self-requested a review October 10, 2024 12:32
@theCapypara theCapypara self-assigned this Oct 10, 2024
Copy link
Member

@Frostbyte0x70 Frostbyte0x70 left a comment

Choose a reason for hiding this comment

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

The fix works, at least on Windows.

@Frostbyte0x70 Frostbyte0x70 merged commit 337286b into SkyTemple:master Nov 1, 2024
17 checks passed
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.

Exporting and re-importing text strings breaks linebreaks
3 participants