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

fs.write() escaping problem #1

Open
mertyildiran opened this issue Dec 19, 2020 · 2 comments
Open

fs.write() escaping problem #1

mertyildiran opened this issue Dec 19, 2020 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@mertyildiran
Copy link
Member

fs.write() escaping the string while writing into the file:

num fp = fs.open('ignored/writeme.txt', 'w')
fs.write(fp, 'You wrote me!\n')
fs.close(fp)

Contents of ignored/writeme.txt file:

You wrote me!\n

Expected:

You wrote me!

@mertyildiran mertyildiran added the bug Something isn't working label Dec 19, 2020
@aqeeph
Copy link

aqeeph commented Dec 20, 2020

I faced a similar problem. While reading from the file, it was also printing \ n characters, which is undesirable. Similar problem and solution: https://stackoverflow.com/questions/16712115/java-how-read-a-file-line-by-line-by-ignoring-n

@mertyildiran
Copy link
Member Author

@aqeeph we have functions like escape_the_sequences_in_string_literal and escape_string_literal_for_transpiler in the language's source that probably causing this bug. But we need to keep those functions and their usages as is. So this fs should mitigate the problem by probably having the inverse implementations of those functions.

It's not related to Java language, I believe you shared as an example but Java is off topic in here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants