8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
It would be great if the following header is supported:
#! /usr/bin/env python # -*- coding: utf-8 -*-
please see: pep-0263
hax workaround:
def get_encoding(path): if not isinstance(path, Path): path = Path(path) with open(path, 'rb') as stream: raw_bytes = stream.read(1024) encoding = chardet.detect(raw_bytes)['encoding'] if path.suffix.lower() == '.py': start_pos = raw_bytes.find(b'-*- coding: ') if start_pos != -1: start_pos += 12 end_pos = raw_bytes[start_pos:].find(b' -*-') if end_pos: end_pos += start_pos coding = raw_bytes[start_pos:end_pos] encoding = coding.decode(encoding) return encoding
The text was updated successfully, but these errors were encountered:
No branches or pull requests
It would be great if the following header is supported:
please see:
pep-0263
hax workaround:
The text was updated successfully, but these errors were encountered: