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

d2parser: Support reading utf16 files #1525

Merged
merged 2 commits into from
Aug 2, 2023
Merged

Conversation

nhooyr
Copy link
Contributor

@nhooyr nhooyr commented Aug 2, 2023

No description provided.

@nhooyr nhooyr marked this pull request as ready for review August 2, 2023 17:28
@nhooyr nhooyr requested a review from alixander August 2, 2023 17:28
@nhooyr nhooyr enabled auto-merge August 2, 2023 17:50
d2parser/parse.go Show resolved Hide resolved
Copy link
Collaborator

@alixander alixander left a comment

Choose a reason for hiding this comment

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

should we write the output in utf-16 too?

@nhooyr
Copy link
Contributor Author

nhooyr commented Aug 2, 2023

For now let's stick to UTF-8 for output.

Will perhaps be annoying with d2 fmt but as far as I know, Windows/modern text editors fully support UTF-8 if detected. A user's text editor will just switch encodings.

@nhooyr nhooyr requested a review from alixander August 2, 2023 18:09
Turns out I was wrong this is safe.
@nhooyr
Copy link
Contributor Author

nhooyr commented Aug 2, 2023

If it ends up being an issue, see utf16_gen.go for how to write Go strings as UTF-16.

@nhooyr nhooyr merged commit 8269390 into terrastruct:master Aug 2, 2023
2 checks passed
@nhooyr nhooyr deleted the utf16 branch August 2, 2023 18:18
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.

2 participants