Discussion:
[Docutils-develop] [docutils:bugs] #315 Filenames with space and non-ASCII characters cause trouble
Getreu
2017-03-31 07:38:44 UTC
Permalink
---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** open
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Fri Mar 31, 2017 07:38 AM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Getreu
2017-03-31 07:42:13 UTC
Permalink
This bug feels like a flash back to the 90ies ;)


---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** open
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Fri Mar 31, 2017 07:38 AM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
David Goodger
2017-03-31 15:52:24 UTC
Permalink
BTW, snide comments are never appreciated. They only increase the likelihood of your bug report being ignored.


---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** pending-remind
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Fri Mar 31, 2017 03:43 PM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
David Goodger
2017-03-31 14:28:38 UTC
Permalink
- **status**: open --> pending-remind
- **Comment**:

Please provide some evidence, such as a minimal example.

http://docutils.sourceforge.net/BUGS.html#how-to-report-a-bug

Exactly what trouble is being caused, and how? Under what Docutils version, Python version, OS?



---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** pending-remind
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Fri Mar 31, 2017 07:42 AM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Getreu
2017-03-31 15:09:03 UTC
Permalink
Consider the following files:
Both referenced files exisist:

~~~
****
tmp8
****

.. image:: größeres Bild.jpg

.. include:: schöne Einleitung.rst
~~~

Html rendition with error messages:

~~~
SystemMessage

/home/getreu/Desktop/tmp8/20170331-tmp8--Notes.rst:7: (SEVERE/4) Problems with "include" directive path:
InputError: [Errno 2] No such file or directory: 'sch\xf6ne Einleitung.rst'.

****
tmp8
****

.. image:: größeres Bild.jpg

.. include:: schöne Einleitung.rst
~~~

My python version is:

~~~
rst2html -V
rst2html (Docutils 0.13.1 [release], Python 2.7.13, on linux2)
~~~



---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** pending-remind
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Fri Mar 31, 2017 02:28 PM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
David Goodger
2017-03-31 15:29:17 UTC
Permalink
Works for me, using the repository version of Docutils on Python 2.7.12 on Ubuntu Linux 16.04:

rst2html.py x.txt ./x.html

What is your OS & version?

What is the encoding of your source file? Please attach all files required to build the example, and specify the command used.

What is the encoding of the filesystem's filename/directory structure?

How do spaces enter into this?


---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** pending-remind
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Fri Mar 31, 2017 03:09 PM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Günter Milde
2017-03-31 15:43:48 UTC
Permalink
I get a similar error (No such file or directory: 'sch\xf6ne Einleitung.rst'.) when the file does not exist (e.g. because the actual file name is "schöne Einleitung.txt"). However, the \xf6 is only a problem in error reporting - including files with non-ASCII characters and spaces works (if the document encoding and the file system encoding match).

The "image" directive expects an URI, not a file name.
With
~~~
.. image:: größeres%20Bild.jpg
~~~
it works as expected.


---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** pending-remind
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Fri Mar 31, 2017 03:09 PM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
David Goodger
2017-03-31 15:51:22 UTC
Permalink
You can also try:

~~~
.. image:: größeres\ Bild.jpg
~~~

"In URIs, backslash-escaped whitespace represents a single space."
— http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html#escaping-mechanism



---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** pending-remind
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Fri Mar 31, 2017 03:43 PM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Getreu
2017-04-01 05:48:42 UTC
Permalink
```
.. image:: größeres%20Bild.jpg

.. include:: schöne Einleitung.rst
```

The above finally works. Thank you guys for your help! I was confused because it does not work `rst2pdf` and `sphinx` the same way.

About URI: URI can be encoded in % encoding but it does not have to be! Especially not when Unicode is available. *I suggest to allowing the following syntax here*:

```
.. image:: größeres Bild.jpg

.. include:: schöne Einleitung.rst
```

BTW: Please note that `größeres%20Bild.jpg` is already not in % encoding: RFC 3986 section 2.3 states that unreserved characters (January 2005) only these ones: `A B C D E F G H I J K L M N O P Q R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9 - _ . ~` Other characters in a URI must be percent encoded and here you already allow "ö" and "ß" (which I apprecheate). So why not allowing " " also?

Besides, URI or not, I think % encoding has no place in a modern markup language nowadays.

Regards




---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** pending-remind
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Fri Mar 31, 2017 03:43 PM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
David Goodger
2017-04-01 14:27:28 UTC
Permalink
Use this syntax:

~~~
.. image:: größeres\ Bild.jpg
~~~

Bare (unescaped) spaces in URIs will not be supported in reST because they are inherently ambiguous.

The fact that the "include" directive works with spaces in the path, without backslashes escaping the spacees, may just be an oversight, a happy accident. "include" is defined as requiring a filesystem path, whereas "image" requires a URI. We may revisit how "include" handles spaces in future.

I'm going to close this bug report.


---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** pending-remind
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Sat Apr 01, 2017 05:48 AM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Getreu
2017-04-02 10:36:10 UTC
Permalink
David,

your solution does not work for me! `.. image:: größeres%20Bild.jpg` is the only way I could access the image.
Post by David Goodger
Bare (unescaped) spaces in URIs will not be supported in reST because they are inherently ambiguous.
Escaped spaces are still better than having % encoding in a markup language! Unfurtunately it does not work as documented.





---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** closed-works-for-me
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Sat Apr 01, 2017 02:28 PM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
David Goodger
2017-04-02 16:14:16 UTC
Permalink
This feature was added recently, and is not part of a release yet. If you want to use it, either wait for new a release or update from the repository.
Please also consider allowing spaces in filen pathames. The escaped notation can be kept in parallel for ambiguous cases.
For consistency, we may eventually implement the following:

~~~
.. include:: path\ with\ spaces.txt
~~~

But as it currently works without the backslash escapes (i.e., the reST parser *already* allows spaces in file paths), it's not a priority.


---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** closed-works-for-me
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Sat Apr 01, 2017 02:28 PM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Getreu
2017-04-03 01:43:26 UTC
Permalink
I found the commit you are referring to: [r8024]. Thank you!


---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** closed-works-for-me
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Sat Apr 01, 2017 02:28 PM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
David Goodger
2017-04-01 14:28:10 UTC
Permalink
- **status**: pending-remind --> closed-works-for-me



---

** [bugs:#315] Filenames with space and non-ASCII characters cause trouble**

**Status:** closed-works-for-me
**Group:** Default
**Created:** Fri Mar 31, 2017 07:38 AM UTC by Getreu
**Last Updated:** Sat Apr 01, 2017 05:48 AM UTC
**Owner:** nobody


Filenames with space and non-ASCII characters cause trouble when used in the ..include or ..image directive.


---

Sent from sourceforge.net because docutils-***@lists.sourceforge.net is subscribed to https://sourceforge.net/p/docutils/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/docutils/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
Loading...