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 double-escaping of newlines #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bryghtlabs-richard
Copy link
Contributor

I'm not sure this is the right approach. It looks like lib/parser.js has a mechanism to un-escape input files, and lib/compiler_template.js has a mechanism to escape output files, and that seemed to make sense, so I was expecting both to run, but it seems esc() was running on the raw text, which was then double-escaped.

This change removes esc().

Fixes #66

@teaalltr
Copy link

Hi @bryghtlabs-richard it works for me, could you merge the PR? Thank you!

@paaspaas00
Copy link

paaspaas00 commented Sep 18, 2024

Hi @bryghtlabs-richard it works for me, could you merge the PR? Thank you!

@bryghtlabs-richard hold on, I'm testing with apostrophe escaping ( slash + ' ), will be able to tell if it works properly in a day or so

@bryghtlabs-richard
Copy link
Contributor Author

Hi all, I'm not a maintainer of lv_i18n - we'll need their review and help, and with anything it's worth taking the time to get it right. Also, I'm not a JS developer, please take this patch with a grain of salt, and I'm not sure this is the right way to handle this - the other option will be to ensure the keys/values get de-escaped on parsing, then re-escaped on output.

@kisvegabor
Copy link
Member

cc @puzrin

So we assume that the characters are correctly escaped in the input strings already, so we can use them as they are, right?

@bryghtlabs-richard
Copy link
Contributor Author

bryghtlabs-richard commented Sep 30, 2024

It seems to work that way, YAML and C seem to share a lot of escape sequences, I tried " and it compiled properly with this patch, but we should check any differences in the language escapes. There are some tests for C unescaping, I'll try to get those running when I look at this again. @rlidwka , any thoughts?

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.

corrupted escape characters
4 participants