@@ -323,8 +323,8 @@ The :mod:`csv` module defines the following constants:
323323.. data :: QUOTE_MINIMAL
324324
325325 Instructs :class: `writer ` objects to only quote those fields which contain
326- special characters such as *delimiter *, *quotechar * or any of the characters in
327- *lineterminator *.
326+ special characters such as *delimiter *, *quotechar *, `` '\r' ``, `` '\n' ``
327+ or any of the characters in *lineterminator *.
328328
329329
330330.. data :: QUOTE_NONNUMERIC
@@ -342,10 +342,13 @@ The :mod:`csv` module defines the following constants:
342342
343343.. data :: QUOTE_NONE
344344
345- Instructs :class: `writer ` objects to never quote fields. When the current
346- *delimiter * occurs in output data it is preceded by the current *escapechar *
347- character. If *escapechar * is not set, the writer will raise :exc: `Error ` if
345+ Instructs :class: `writer ` objects to never quote fields.
346+ When the current *delimiter *, *quotechar *, *escapechar *, ``'\r' ``, ``'\n' ``
347+ or any of the characters in *lineterminator * occurs in output data
348+ it is preceded by the current *escapechar * character.
349+ If *escapechar * is not set, the writer will raise :exc: `Error ` if
348350 any characters that require escaping are encountered.
351+ Set *quotechar * to ``None `` to prevent its escaping.
349352
350353 Instructs :class: `reader ` objects to perform no special processing of quote characters.
351354
@@ -414,9 +417,16 @@ Dialects support the following attributes:
414417
415418.. attribute :: Dialect.escapechar
416419
417- A one-character string used by the writer to escape the *delimiter * if *quoting *
418- is set to :const: `QUOTE_NONE ` and the *quotechar * if *doublequote * is
419- :const: `False `. On reading, the *escapechar * removes any special meaning from
420+ A one-character string used by the writer to escape characters that
421+ require escaping:
422+
423+ * the *delimiter *, the *quotechar *, ``'\r' ``, ``'\n' `` and any of the
424+ characters in *lineterminator * are escaped if *quoting * is set to
425+ :const: `QUOTE_NONE `;
426+ * the *quotechar * is escaped if *doublequote * is :const: `False `;
427+ * the *escapechar * itself.
428+
429+ On reading, the *escapechar * removes any special meaning from
420430 the following character. It defaults to :const: `None `, which disables escaping.
421431
422432 .. versionchanged :: 3.11
@@ -436,9 +446,12 @@ Dialects support the following attributes:
436446
437447.. attribute :: Dialect.quotechar
438448
439- A one-character string used to quote fields containing special characters, such
440- as the *delimiter * or *quotechar *, or which contain new-line characters. It
441- defaults to ``'"' ``.
449+ A one-character string used to quote fields containing special characters,
450+ such as the *delimiter * or the *quotechar *, or which contain new-line
451+ characters (``'\r' ``, ``'\n' `` or any of the characters in *lineterminator *).
452+ It defaults to ``'"' ``.
453+ Can be set to ``None `` to prevent escaping ``'"' `` if *quoting * is set
454+ to :const: `QUOTE_NONE `.
442455
443456 .. versionchanged :: 3.11
444457 An empty *quotechar * is not allowed.
@@ -447,7 +460,8 @@ Dialects support the following attributes:
447460
448461 Controls when quotes should be generated by the writer and recognised by the
449462 reader. It can take on any of the :ref: `QUOTE_\* constants <csv-constants >`
450- and defaults to :const: `QUOTE_MINIMAL `.
463+ and defaults to :const: `QUOTE_MINIMAL ` if *quotechar * is not ``None ``,
464+ and :const: `QUOTE_NONE ` otherwise.
451465
452466
453467.. attribute :: Dialect.skipinitialspace
0 commit comments