unicodecsv


Nameunicodecsv JSON
Version 0.14.1 PyPI version JSON
download
home_pagehttps://github.com/jdunck/python-unicodecsv
SummaryPython2's stdlib csv module is nice, but it doesn't support unicode. This module is a drop-in replacement which *does*.
upload_time2015-09-22 22:00:19
maintainerNone
docs_urlNone
authorJeremy Dunck
requires_pythonNone
licenseBSD License
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            unicodecsv
==========

The unicodecsv is a drop-in replacement for Python 2.7's csv module which supports unicode strings without a hassle.  Supported versions are python 2.7, 3.3, 3.4, 3.5, and pypy 2.4.0.

More fully
----------

Python 2's csv module doesn't easily deal with unicode strings, leading to the dreaded "'ascii' codec can't encode characters in position ..." exception.

You can work around it by encoding everything just before calling write (or just after read), but why not add support to the serializer?

.. code-block:: pycon

   >>> import unicodecsv as csv
   >>> from io import BytesIO
   >>> f = BytesIO()
   >>> w = csv.writer(f, encoding='utf-8')
   >>> _ = w.writerow((u'é', u'ñ'))
   >>> _ = f.seek(0)
   >>> r = csv.reader(f, encoding='utf-8')
   >>> next(r) == [u'é', u'ñ']
   True

Note that unicodecsv expects a bytestream, not unicode -- so there's no need to use `codecs.open` or similar wrappers.  Plain `open(..., 'rb')` will do.

(Version 0.14.0 dropped support for python 2.6, but 0.14.1 added it back.  See c0b7655248c4249 for the mistaken, breaking change.)
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jdunck/python-unicodecsv",
    "name": "unicodecsv",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Jeremy Dunck",
    "author_email": "jdunck@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6f/a4/691ab63b17505a26096608cc309960b5a6bdf39e4ba1a793d5f9b1a53270/unicodecsv-0.14.1.tar.gz",
    "platform": "UNKNOWN",
    "description": "unicodecsv\n==========\n\nThe unicodecsv is a drop-in replacement for Python 2.7's csv module which supports unicode strings without a hassle.  Supported versions are python 2.7, 3.3, 3.4, 3.5, and pypy 2.4.0.\n\nMore fully\n----------\n\nPython 2's csv module doesn't easily deal with unicode strings, leading to the dreaded \"'ascii' codec can't encode characters in position ...\" exception.\n\nYou can work around it by encoding everything just before calling write (or just after read), but why not add support to the serializer?\n\n.. code-block:: pycon\n\n   >>> import unicodecsv as csv\n   >>> from io import BytesIO\n   >>> f = BytesIO()\n   >>> w = csv.writer(f, encoding='utf-8')\n   >>> _ = w.writerow((u'\u00e9', u'\u00f1'))\n   >>> _ = f.seek(0)\n   >>> r = csv.reader(f, encoding='utf-8')\n   >>> next(r) == [u'\u00e9', u'\u00f1']\n   True\n\nNote that unicodecsv expects a bytestream, not unicode -- so there's no need to use `codecs.open` or similar wrappers.  Plain `open(..., 'rb')` will do.\n\n(Version 0.14.0 dropped support for python 2.6, but 0.14.1 added it back.  See c0b7655248c4249 for the mistaken, breaking change.)",
    "bugtrack_url": null,
    "license": "BSD License",
    "summary": "Python2's stdlib csv module is nice, but it doesn't support unicode. This module is a drop-in replacement which *does*.",
    "version": "0.14.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "c18ffe8ded29a4f429224877b2b34252",
                "sha256": "018c08037d48649a0412063ff4eda26eaa81eff1546dbffa51fa5293276ff7fc"
            },
            "downloads": -1,
            "filename": "unicodecsv-0.14.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c18ffe8ded29a4f429224877b2b34252",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 10267,
            "upload_time": "2015-09-22T22:00:19",
            "upload_time_iso_8601": "2015-09-22T22:00:19.516621Z",
            "url": "https://files.pythonhosted.org/packages/6f/a4/691ab63b17505a26096608cc309960b5a6bdf39e4ba1a793d5f9b1a53270/unicodecsv-0.14.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2015-09-22 22:00:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "jdunck",
    "github_project": "python-unicodecsv",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "unicodecsv"
}
        
Elapsed time: 0.01326s