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

Add template encoding option #446

Closed

Conversation

timorieber
Copy link
Contributor

Fixes #445.

I have implemented a new option to specify the actual template encoding and extended the loader mechanism. Also did some refactoring in the read_templates function for better readability and testability.

@timorieber timorieber force-pushed the feature/template-encoding-option branch 4 times, most recently from 79fc424 to 1d73cc2 Compare January 10, 2023 18:34
@timorieber timorieber force-pushed the feature/template-encoding-option branch from 1d73cc2 to a2c4269 Compare January 10, 2023 18:37
@rmilecki
Copy link
Collaborator

I'm not sure if we need all that encoding at all. We should also clarify that unclear

# -*- coding: utf-8 -*-

like syntax.

As for you actual changes here, your commit "Implement yaml option for template encoding" does a lot of refactoring and rewording that isn't related to actual issue. In my opinion that should go to another pull request so we can focus on one thing at a time.

@timorieber
Copy link
Contributor Author

This PR is meant as a short-term backwards-compatible approach to this template encoding issue. For the longer term I support your plan of removing this "magic" and assume utf-8 template encoding.

I had a harder time than expected understanding what's going on in this code. As I'm a big fan of Robert C. Martin's "boyscout rule" to "leave the code better than you found it" and Martin Fowler's "opportunistic refactoring" I first wrote some tests (there were none) and afterwards split things up a little bit. I'm pretty confident that it works just like expected.

I'm also fine when this PR gets closed, but I think it's the right direction.

@rmilecki
Copy link
Collaborator

Obsoleted by #449

Cleanup of existing templates is pending: #452

@rmilecki rmilecki closed this Jan 25, 2023
@timorieber timorieber deleted the feature/template-encoding-option branch January 29, 2023 09:35
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.

Automatic encoding detection for template files fails for single german umlaut
2 participants