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

SketchupSuggestions/FileEncoding - still valid? #157

Open
MSP-Greg opened this issue Jul 23, 2022 · 2 comments
Open

SketchupSuggestions/FileEncoding - still valid? #157

MSP-Greg opened this issue Jul 23, 2022 · 2 comments

Comments

@MSP-Greg
Copy link

See:

https://rubocop-sketchup.readthedocs.io/en/latest/cops_suggestions/#sketchupsuggestionsfileencoding

The 'cop' involves encoding of __dir__ & __FILE__. I tested with SU 2017, which I think is the first version supporting UI::HtmlDialog. I couldn't repo it, both reported being encoded as UTF-8.

I tested with a directory of C:/Ruby киї_テスト, which seems like it would be a valid test for encoding?

So, if encoding isn't an issue, maybe the 'cop' should be removed or disabled?

@thomthom
Copy link
Member

This cop has nothing to do with UI::HtmlDialog.

I couldn't repo it, both reported being encoded as UTF-8.

Have you done some tweaks to your system set some environment variables to force Ruby to default to UTF-8?
The issue is that both __FILE__ and __dir__ will on a default system install return US-ASCII even though the byte sequence is UTF-8. The issue was reported to Ruby code, but determined a fix would not be applied to 2.x for backwards compatible, but instead (possibly) for 3.x. We need to test if this is finally fixed in Ruby 3 and do a check against target Ruby version.

@MSP-Greg
Copy link
Author

This cop has nothing to do with UI::HtmlDialog.

I know. That was the reason I used SU 2017.

Have you done some tweaks to your system set some environment variables to force Ruby to default to UTF-8

Yes, but I reverted/removed them when checking this issue. I did not re-enable them (yet).

I found some old SU versions on my old drives, and checked this using SU 2015. It seems to work fine. Not sure if it related to fixes in Windows 11, as I vaguely recall that it's more UTF-8 compatible?

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

No branches or pull requests

2 participants