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

feat: Make sure that dafny run always requests UTF-8 encoded output #3049

Merged
merged 6 commits into from
Nov 17, 2022

Conversation

cpitclaudel
Copy link
Member

Closes #2999 (but beware of encoding issues in Go and C++).

@cpitclaudel cpitclaudel force-pushed the cpitclaudel_dafny-run-utf-8 branch 2 times, most recently from 4119777 to cbc58b4 Compare November 12, 2022 03:15
@cpitclaudel cpitclaudel added the run-deep-tests Tells CI to run all tests label Nov 12, 2022
Closes #2999 (but beware of encoding issues in Go and C++).
Copy link
Member

@robin-aws robin-aws left a comment

Choose a reason for hiding this comment

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

Whew, nice. I assume Go didn't need any changes because it already enforces UTF-8 output?

Source/DafnyDriver/DafnyDriver.cs Outdated Show resolved Hide resolved
Comment on lines +1733 to +1736
(e.g. `-Dfile.encoding=` for Java). This is in fact how `dafny run` operates:
it uses language-specific flags and variables to enforce UTF-8 output regardless
of the target language (but note that the C++ and Go backends currently have
limited support for UTF-16 surrogates).
Copy link
Member

Choose a reason for hiding this comment

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

This is great but I feel it should also be in documentation specifically for the dafny run command and not just for the print statement. Perhaps http:https://dafny.org/dafny/DafnyRef/DafnyRef#256-using-dafny-from-the-command-line?

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do.

@cpitclaudel
Copy link
Member Author

I assume Go didn't need any changes because it already enforces UTF-8 output?

Well, not really; it's more that Go passes strings through without modification, so as long as we construct UTF-8 we're fine (which we do for since UTF-16 code units, but not for paired ones, hence the commented-out part of the test.

Copy link
Member

@robin-aws robin-aws left a comment

Choose a reason for hiding this comment

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

0xF0 0x9F 0x9A 0x80

:)

@robin-aws robin-aws enabled auto-merge (squash) November 17, 2022 01:51
@robin-aws robin-aws merged commit c3cf9a2 into master Nov 17, 2022
@robin-aws robin-aws deleted the cpitclaudel_dafny-run-utf-8 branch November 17, 2022 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-deep-tests Tells CI to run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change dafny run to always force UTF-8 output
2 participants