Character '\xd1' result in TypeError

Daniel Darabos avatarDaniel Darabos created an issue

Using Sphinx 0.6.1 on a Mac OS 10.5.7 (using built-in Python 2.5.1) if a document contains a long dash (— in html, easily typed on a Mac using Alt-Shift-Minus) I get this exception:

File "/Library/Python/2.5/site-packages/Sphinx-0.6.1-py2.5.egg/sphinx/environment.py", line 537, in warn_and_replace
    linestart = error.object.rfind('\n', None, error.start)
TypeError: slice indices must be integers or None or have an __index__ method

I have attached the full traceback and an example source file. I created the file in TextEdit, the default Mac OS X editor, and it looks like the file is not UTF-8, but "Mac OS Roman" and represents the long dash as '\xd1'. So it looks like this character is responsible for the error.

Of course when I save the file as UTF-8 everything works, so this is what I will do.

Comments (1)

  1. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.