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

Invalid line length with utf8 characters #7

Closed
vslinko opened this issue Apr 11, 2010 · 3 comments
Closed

Invalid line length with utf8 characters #7

vslinko opened this issue Apr 11, 2010 · 3 comments

Comments

@vslinko
Copy link

vslinko commented Apr 11, 2010

Simple patch.

211c211

< length = len(physical_line.rstrip())


length = len(unicode(physical_line.rstrip(), 'utf-8'))
@jcrocholl
Copy link
Contributor

But this will raise UnicodeDecodeError if the input file uses a different encoding. Example: With latin-1 you would have things like physical_line = "\xe4".

@jcrocholl
Copy link
Contributor

We're currently using latin-1 fallback in case UTF-8 could not be decoded. A better solution would be to detect the encoding correctly, but maybe that's overkill if only for line length.

@vslinko
Copy link
Author

vslinko commented Oct 4, 2010

I think you right.

This issue was closed.
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