-
Notifications
You must be signed in to change notification settings - Fork 134
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
Backslash not removed when escaping quotes in strings #213
Comments
Interesting, thanks for opening this issue. |
Interesting... the string is un-escaped after the parser. I'll dig into it a bit more. |
I believe the problem is that the result of mine block is being processed by a Some(output) => format!("{}", output), And the implementation for the String clarity value uses this function from clarity/types/mod.rs:415: impl fmt::Display for ASCIIData {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut escaped_str = String::new();
for c in self.data.iter() {
let escaped_char = format!("{}", std::ascii::escape_default(*c));
escaped_str.push_str(&escaped_char);
}
write!(f, "{}", format!("\"{}\"", escaped_str))
}
} I should be able to fix it tomorrow. |
Ok, I've got a fix in 5505ad8. I'm going to add some unit tests before opening a PR. I've basically just added a recursive function to print the |
Tested locally and it's fixed 🙌 |
# [0.24.0](v0.23.1...v0.24.0) (2022-01-19) ### Bug Fixes * fixed broken links ([b0f073a](b0f073a)) * generate proper strings from contract results ([6b189c6](6b189c6)), closes [#213](#213) * only code-sign on release ([e10f3d1](e10f3d1)) * resolve bug with windows build in CI ([16ccd00](16ccd00)) ### Features * added ignore and only options to clarinet test ([a57cc23](a57cc23))
🎉 This issue has been resolved in version 0.24.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
On clarinet the escaping backslashes are not removed in strings (ascii or utf8).
On the testnet it works as intended
Code to reproduce:
I also realised that backslashes are added before single quotes. Please tell me if I should open a second issue about that
The text was updated successfully, but these errors were encountered: