diff options
| author | Claude Paroz <claude@2xlibre.net> | 2014-04-26 16:09:19 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2014-04-26 16:09:19 +0200 |
| commit | 2128b3a6887a45e99724f52ac2eaf4a5f4d97c84 (patch) | |
| tree | bd7ace5f7ae39b263f6d898d46936f7c3ce9c184 /docs/howto/outputting-csv.txt | |
| parent | 680a0f08b1ace39f995fce975caabb1875b07c6f (diff) | |
Specified 'csv and unicode' note as Python 2 only
Diffstat (limited to 'docs/howto/outputting-csv.txt')
| -rw-r--r-- | docs/howto/outputting-csv.txt | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt index 8e7c311757..d1a778db47 100644 --- a/docs/howto/outputting-csv.txt +++ b/docs/howto/outputting-csv.txt @@ -54,26 +54,25 @@ mention: about escaping strings with quotes or commas in them. Just pass ``writerow()`` your raw strings, and it'll do the right thing. -Handling Unicode -~~~~~~~~~~~~~~~~ +.. admonition:: Handling Unicode on Python 2 -Python's :mod:`csv` module does not support Unicode input. Since Django uses -Unicode internally this means strings read from sources such as -:class:`~django.http.HttpRequest` are potentially problematic. There are a few -options for handling this: + Python 2's :mod:`csv` module does not support Unicode input. Since Django + uses Unicode internally this means strings read from sources such as + :class:`~django.http.HttpRequest` are potentially problematic. There are a + few options for handling this: -* Manually encode all Unicode objects to a compatible encoding. + * Manually encode all Unicode objects to a compatible encoding. -* Use the ``UnicodeWriter`` class provided in the `csv module's examples - section`_. + * Use the ``UnicodeWriter`` class provided in the `csv module's examples + section`_. -* Use the `python-unicodecsv module`_, which aims to be a drop-in - replacement for :mod:`csv` that gracefully handles Unicode. + * Use the `python-unicodecsv module`_, which aims to be a drop-in + replacement for :mod:`csv` that gracefully handles Unicode. -For more information, see the Python documentation of the :mod:`csv` module. + For more information, see the Python documentation of the :mod:`csv` module. -.. _`csv module's examples section`: http://docs.python.org/library/csv.html#examples -.. _`python-unicodecsv module`: https://github.com/jdunck/python-unicodecsv + .. _`csv module's examples section`: http://docs.python.org/2/library/csv.html#examples + .. _`python-unicodecsv module`: https://github.com/jdunck/python-unicodecsv .. _streaming-csv-files: |
