Skip to content

Help files should be UTF-8 encoded #251

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

Closed
juneb opened this issue Jun 24, 2015 · 7 comments
Closed

Help files should be UTF-8 encoded #251

juneb opened this issue Jun 24, 2015 · 7 comments

Comments

@juneb
Copy link
Contributor

juneb commented Jun 24, 2015

Can we test help files in the modules, both XML and TXT, to assure that the encoding is UTF-8? There should be an error if it has any other encoding.

@KirkMunro
Copy link
Contributor

Good idea! I'd like to see this check ps1, psm1, psd1, and ps1xml file encodings as well, warning on any files that are not UTF-8 encoded.

@yutingc
Copy link
Contributor

yutingc commented Jun 24, 2015

Thanks @juneb and @KirkMunro for the suggestions! We will consider adding the rule to verify the encoding.

@quoctruong quoctruong self-assigned this Jun 24, 2015
@gwojan
Copy link

gwojan commented Jun 25, 2015

Does it have to be UTF-8 with BOM? There are still lots of tools out that that don't handle BOM well.

@rkeithhill
Copy link
Contributor

@KirkMunro You do realize that the PSD1 file generated by New-ModuleManifest is Unicode and not UTF-8? So I don't think it would be such a good idea to require UTF-8 for these files. In general, PowerShell creates Unicode files and not UTF-8 files.

WRT to text files, ASCII files are valid UTF-8 files sans BOM as long as they stick to the range 0x00 - 0x7F.

@KirkMunro
Copy link
Contributor

@rkeithhill: That's odd, and no, I hadn't realized that. ISE saves using UTF-8 by default, as did PowerGUI, and PowerSE. Why would New-ModuleManifest create a UTF-16 file then? I know there were some issues with which encoding was being used in the past, wrt to the editor that was used -- IIRC ISE couldn't open files with certain encodings.

At any rate, you're right, for most cmdlets, the default value for -Encoding is Unicode (UTF-16). There isn't enough consensus here to form a rule for PowerShell files though. Maybe for XML files, since XML's encoding should match the encoding identified inside at the top of the xml file.

@juneb
Copy link
Contributor Author

juneb commented Jun 29, 2015

My recommendation applied only to help files, which are expected to be UTF-8, not to other file types.

@quoctruong
Copy link

The new rule is implemented with #288

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants