SF.net SVN: docutils:[10367 ] trunk/docutils

milde--- via Docutils-checkins <[email protected]> Mon, 22 Jun 2026 12:04:21 +0000
Newsgroups gmane.text.docutils.cvs
Message-ID <[email protected]>
Revision: 10367
          http://sourceforge.net/p/docutils/code/10367
Author:   milde
Date:     2026-06-22 12:04:21 +0000 (Mon, 22 Jun 2026)
Log Message:
-----------
End support for the special "encoding" value "" (empty string).

Remove exception for `""` in `frontend.validate_encoding()`.

Fix error message for unknown encodings.

Modified Paths:
--------------
    trunk/docutils/HISTORY.rst
    trunk/docutils/RELEASE-NOTES.rst
    trunk/docutils/docutils/frontend.py

Modified: trunk/docutils/HISTORY.rst
===================================================================
--- trunk/docutils/HISTORY.rst	2026-06-18 13:28:08 UTC (rev 10366)
+++ trunk/docutils/HISTORY.rst	2026-06-22 12:04:21 UTC (rev 10367)
@@ -32,6 +32,7 @@
   - Accept the short option ``-o`` for ``--output`` (settings.output_path).
   - Drop the second positional argument <destination>.
     Solves feature-request #36.
+  - End support for the special value ``""`` in `validate_encoding()`.
 
 * docutils/io.py
 

Modified: trunk/docutils/RELEASE-NOTES.rst
===================================================================
--- trunk/docutils/RELEASE-NOTES.rst	2026-06-18 13:28:08 UTC (rev 10366)
+++ trunk/docutils/RELEASE-NOTES.rst	2026-06-22 12:04:21 UTC (rev 10367)
@@ -227,7 +227,8 @@
 
 Configuration changes:
   - `Auto-detection`_ of the input encoding is no longer supported.
-    The input_encoding_ value ``None`` now stands for "utf-8".
+    The input_encoding_ value ``None`` now stands for "utf-8",
+    the empty string now leads to a LookupError.
   - The section_self_link_ setting now defaults to True.
   - The use_latex_citations_ setting now defaults to True.
   - The legacy_column_widths_ setting now defaults to False.

Modified: trunk/docutils/docutils/frontend.py
===================================================================
--- trunk/docutils/docutils/frontend.py	2026-06-18 13:28:08 UTC (rev 10366)
+++ trunk/docutils/docutils/frontend.py	2026-06-22 12:04:21 UTC (rev 10367)
@@ -138,16 +138,10 @@
     # If there is only one positional argument, it is interpreted as `value`.
     if value is None:
         value = setting
-    if value == '':
-        warnings.warn('Input encoding detection will be removed and the '
-                      'special encoding values None and "" become invalid '
-                      'in Docutils 1.0.', FutureWarning, stacklevel=2)
-        return None
     try:
         codecs.lookup(value)
     except LookupError:
-        prefix = f'setting "{setting}":' if setting else ''
-        raise LookupError(f'{prefix} unknown encoding: "{value}"')
+        raise LookupError(f'unknown encoding: "{value}"')
     return value
 
 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.