{ "info": { "author": "Box", "author_email": "oss@box.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: OS Independent", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Testing" ], "description": "rotunicode\n==========\n\n.. image:: http://opensource.box.com/badges/active.svg\n :target: http://opensource.box.com/badges\n\n.. image:: https://travis-ci.org/box/rotunicode.png?branch=master\n :target: https://travis-ci.org/box/rotunicode\n\n.. image:: https://coveralls.io/repos/box/rotunicode/badge.png\n :target: https://coveralls.io/r/box/rotunicode\n\n.. image:: https://img.shields.io/pypi/v/rotunicode.svg\n :target: https://pypi.python.org/pypi/rotunicode\n\n.. image:: https://img.shields.io/pypi/dm/rotunicode.svg\n :target: https://pypi.python.org/pypi/rotunicode\n\n\nRotUnicode is a Python library that can convert a string containing ASCII\ncharacters to a string with non-ASCII characters without losing readability.\n\n.. code-block:: pycon\n\n >>> 'Hello World!'.encode('rotunicode')\n \u0124\u0205\u013e\u013e\u0151 \u0174\u0151\u0155\u013e\u010f!\n >>> '\u0124\u0205\u013e\u013e\u0151 \u0174\u0151\u0155\u013e\u010f!'.decode('rotunicode')\n Hello World!\n\nIn the above example, the 'Hello World' string has all ASCII characters.\nEncoding it with RotUnicode gives you '\u0124\u0205\u013e\u013e\u0151 \u0174\u0151\u0155\u013e\u010f' which reads like\n'Hello World' but has all non-ASCII characters.\n\n\nWhy is this named RotUnicode?\n-----------------------------\n\nRotUnicode stands for rotate-to-unicode. Or rotten-unicode for those who have\nnightmares about Unicode. It was inspired by Rot13.\n\n\nSupported Characters\n--------------------\n\nRotUnicode converts lower case and upper case characters of the English\nalphabet and digits 0 to 9 to non-ASCII characters. All characters that are\noutside this range are left as is.\n\n.. code-block:: pycon\n\n >>> '\u0939\u0947\u0932\u094b World!'.encode('rotunicode')\n \u0939\u0947\u0932\u094b \u0174\u0151\u0155\u013e\u010f!\n >>> '\u0939\u0947\u0932\u094b \u0174\u0151\u0155\u013e\u010f!'.decode('rotunicode')\n \u0939\u0947\u0932\u094b World!\n\n\nInstallation\n------------\n\nTo install, simply:\n\n.. code-block:: console\n\n pip install rotunicode\n\n\nUse\n---\n\n.. code-block:: pycon\n\n >>> from rotunicode import ruencode\n >>> ruencode('Hello World!')\n \u0124\u0205\u013e\u013e\u0151 \u0174\u0151\u0155\u013e\u010f!\n >>> rudecode('\u0124\u0205\u013e\u013e\u0151 \u0174\u0151\u0155\u013e\u010f!')\n Hello World!\n\n\nAs a Codec\n----------\n\nIn Python 2, RotUnicode can also be used as a codec, but it must first\nbe registered with the codecs library. This allows python to know what\nfunctions to call to encode or decode a string using RotUnicode.\n\n.. code-block:: pycon\n\n >>> import codecs\n >>> from rotunicode import RotUnicode\n >>> codecs.register(RotUnicode.search_function)\n >>> 'Hello World!'.encode('rotunicode')\n \u0124\u0205\u013e\u013e\u0151 \u0174\u0151\u0155\u013e\u010f!\n\n\nCommand Line\n------------\n\nInstalling RotUnicode also includes a command line tool.\n\n.. code-block:: console\n\n $ rotunicode \"Hello World\"\n \u0124\u0205\u013e\u013e\u0151 \u0174\u0151\u0155\u013e\u010f!\n $ rotunicode -d \"\u0124\u0205\u013e\u013e\u0151 \u0174\u0151\u0155\u013e\u010f!\"\n Hello World!\n $ echo \"Hello World!\" > hello.txt\n $ rotunicode -f hello.txt\n \u0124\u0205\u013e\u013e\u0151 \u0174\u0151\u0155\u013e\u010f!\n $ cat hello.txt | rotunicode -f\n \u0124\u0205\u013e\u013e\u0151 \u0174\u0151\u0155\u013e\u010f!\n\n\nWhy should I use RotUnicode?\n----------------------------\n\nRotUnicode it extremely helpful in testing because it reduces the friction for\ndevelopers to test with non-ASCII strings. Imagine for example that you have a\nclass to represent a contact for your address book application:\n\n.. code-block:: python\n\n class Contact(object):\n\n def __init__(self, first_name, last_name):\n super(Contact, self).__init__()\n self.first_name = first_name\n self.last_name = last_name\n\n def display_name(self):\n return '{} {}'.format(self.first_name, self.last_name)\n\nMost developers would test this as follows:\n\n.. code-block:: python\n\n from unittest import TestCase\n from contact import Contact\n\n class ContactTests(TestCase):\n\n def test_display_name(self):\n contact = Contact('John', 'Doe\u2019)\n self.assertEqual('John Doe', contact.display_name()))\n\nThis test is good. But it is going to miss catching problems in the code with\nnon-ASCII characters. Requiring developers to remember how to type non-ASCII\ncharacters is not practical. With RotUnicode, this is super easy:\n\n.. code-block:: python\n\n from unittest import TestCase\n from contact import Contact\n\n class ContactTests(TestCase):\n\n def test_display_name_with_ascii_name(self):\n contact = Contact(u'John', u'Doe')\n self.assertEqual(u'John Doe', contact.display_name())\n\n def test_display_name_with_non_ascii_name(self):\n contact = Contact(ruencode(u'John'), ruencode(u'Doe'))\n self.assertEqual(ruencode(u'John Doe'), contact.display_name())\n\n\nThis is an example of a bug in Python\n(`issue18695 `_) with non-ASCII characters -\n\n.. code-block:: pycon\n\n >>> import os, errno\n >>> name = 'foo'.encode('rotunicode')\n >>> os.mkdir(name)\n >>> print(name)\n \u0192\u0151\u0151\n >>> os.path.exists(name)\n True\n >>> os.statvfs(name)\n Traceback (most recent call last):\n File \"\", line 1, in \n UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2:\n ordinal not in range(128)\n\n\nContribute\n----------\n\nSee `CONTRIBUTING `_.\n\n\nSetup\n~~~~~\n\nCreate a virtual environment and install packages:\n\n.. code-block:: console\n\n mkvirtualenv rotunicode\n pip install -r requirements-dev.txt\n\n\nTesting\n~~~~~~~\n\nRun all tests using:\n\n.. code-block:: console\n\n tox\n\nThe tox tests include code style checks via pep8 and pylint.\n\nThe tox tests are configured to run on Python 2.7, 3.4, 3.5, 3.6, 3.7,\nand PyPy2.7 (version 5.10).\n\n\nCopyright and License\n---------------------\n\n::\n\n Copyright 2019 Box, Inc. All rights reserved.\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/box/rotunicode", "keywords": "", "license": "Apache Software License, Version 2.0, http://www.apache.org/licenses/LICENSE-2.0", "maintainer": "", "maintainer_email": "", "name": "rotunicode", "package_url": "https://pypi.org/project/rotunicode/", "platform": "", "project_url": "https://pypi.org/project/rotunicode/", "project_urls": { "Homepage": "https://github.com/box/rotunicode" }, "release_url": "https://pypi.org/project/rotunicode/2.3.0/", "requires_dist": [ "six (>=1.9.0)" ], "requires_python": "", "summary": "Python library for converting between a string of ASCII and non-ASCII chars maintaining readability", "version": "2.3.0" }, "last_serial": 4753195, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "8593e842714a166f7fb1ceaec9f7095e", "sha256": "b00c0f418d2086de78463367ec83d50b5d81d5ea3de0bb16405168809e34710d" }, "downloads": -1, "filename": "rotunicode-0.1.0.tar.gz", "has_sig": false, "md5_digest": "8593e842714a166f7fb1ceaec9f7095e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2818, "upload_time": "2013-08-18T09:33:04", "url": "https://files.pythonhosted.org/packages/18/89/512f701b4ba6171bbfd42a8939af3eb966db3440599491ff29fb170722a6/rotunicode-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d5235b9ee8c7aeb62561fa1171f84d8e", "sha256": "0ddf69a2376ae376c2b3f0cd221791387c859c61830a214c820a13c6093af9d8" }, "downloads": -1, "filename": "rotunicode-0.1.1.tar.gz", "has_sig": false, "md5_digest": "d5235b9ee8c7aeb62561fa1171f84d8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2816, "upload_time": "2013-08-18T09:42:59", "url": "https://files.pythonhosted.org/packages/a9/7e/097325f636c3b916a2b5f89f0cdac5b22ce4b1ae5d574c02d8b298dd650b/rotunicode-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "1ff9e552ebd018bd270051296af29b1a", "sha256": "159c7e9795d209b3fda4f09a2fdb990323ba918d1852b2fb3e4ecb6c8a95d647" }, "downloads": -1, "filename": "rotunicode-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1ff9e552ebd018bd270051296af29b1a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3207, "upload_time": "2013-08-18T10:44:17", "url": "https://files.pythonhosted.org/packages/49/8d/5a590d25ce538199b2e22a5ab03165180e76816390952532dd1f0bdfb321/rotunicode-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "dd9b4a007e77bf0dc02a3fa1518e9b70", "sha256": "64e525b09e3b5307b4ddbf72018fc14f74cd574d83fc25e854bc8330804b11a5" }, "downloads": -1, "filename": "rotunicode-0.1.3.tar.gz", "has_sig": false, "md5_digest": "dd9b4a007e77bf0dc02a3fa1518e9b70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4106, "upload_time": "2013-08-22T05:39:21", "url": "https://files.pythonhosted.org/packages/2a/f9/42ab99979b479620833e460b91c0abfe31b1dc4ee93aea74be44b9e02d44/rotunicode-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "9ce2e11c6b34852fec36e508c2e39407", "sha256": "3bbf77a4b3dd8fe6fbfc339151240b8b3a2852a8bcb5f9d1d6e07438c4f793c8" }, "downloads": -1, "filename": "rotunicode-0.1.4.tar.gz", "has_sig": false, "md5_digest": "9ce2e11c6b34852fec36e508c2e39407", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4087, "upload_time": "2013-08-22T07:30:35", "url": "https://files.pythonhosted.org/packages/68/53/7e7cd05f55d6d315d46d4cc26be83e04d4ebb58a383e14d6526dd6719527/rotunicode-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "ae2179f9a40fa4fa757ee230891c3ba1", "sha256": "685aa01d9aab83328704cb99c32cccd0bc0d6ca1d0f4ae7bb7d54aa910a10d26" }, "downloads": -1, "filename": "rotunicode-0.1.5.tar.gz", "has_sig": false, "md5_digest": "ae2179f9a40fa4fa757ee230891c3ba1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4936, "upload_time": "2013-12-30T09:30:05", "url": "https://files.pythonhosted.org/packages/fd/a8/553aa876affcd0afa8b15dda99f4064fe088c5d7eb6e6a97066426c7a5e7/rotunicode-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "eb23ab4ddeea1ea0f0dc3a2e69459d16", "sha256": "9d83fcf9b855bd697eb5e2d13a7785523e63ea1dfa0b7e2148569a29f1c7154b" }, "downloads": -1, "filename": "rotunicode-0.1.6.tar.gz", "has_sig": false, "md5_digest": "eb23ab4ddeea1ea0f0dc3a2e69459d16", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5140, "upload_time": "2013-12-31T10:14:21", "url": "https://files.pythonhosted.org/packages/13/78/ce0ab2384ea79cd8a70dbda7d18d49f53330942139c5c684a8f30dd8d554/rotunicode-0.1.6.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "5138049a851db9817a3ba9c148f60fad", "sha256": "29197bd285b77d3952fcb9fdf00e641638a582f36d5fd31205f1a65ef1650cbb" }, "downloads": -1, "filename": "rotunicode-1.0.0.tar.gz", "has_sig": false, "md5_digest": "5138049a851db9817a3ba9c148f60fad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8955, "upload_time": "2014-01-29T22:46:03", "url": "https://files.pythonhosted.org/packages/0f/c0/e7572a2c3f79b61365f475a0986cf035bb891f15f73ae4dbea009958cf71/rotunicode-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "ae1388f409643236e20de4cb989a335f", "sha256": "e0d6376ecd44b5422662c47425f3a0ed6207ff975698d4a59588e98237138acf" }, "downloads": -1, "filename": "rotunicode-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ae1388f409643236e20de4cb989a335f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8893, "upload_time": "2014-02-05T02:27:21", "url": "https://files.pythonhosted.org/packages/a7/e6/8fa2e82df1121f97fdc15650782d8096eb411c341f6ac9339cb5ffb66c9a/rotunicode-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "749a85443395027933a757a7e7d3f824", "sha256": "0e4eb370b8eab2a72c30a518be66e332b0f5ca64f6a0dc8e8140fb36307f5404" }, "downloads": -1, "filename": "rotunicode-1.0.2.tar.gz", "has_sig": false, "md5_digest": "749a85443395027933a757a7e7d3f824", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8875, "upload_time": "2014-04-03T22:31:59", "url": "https://files.pythonhosted.org/packages/8f/e2/9e1d6fcb3e65d473b56a01bf5de881c0244393d00c23338aae60d41c950c/rotunicode-1.0.2.tar.gz" } ], "1.1.2": [ { "comment_text": "", "digests": { "md5": "55421b38cf5d54f2bbbdcc7690ff28bc", "sha256": "1be622dc51cbff4cbeba857be4d450ee36ea48acb7cd117d89ef6e2861f93937" }, "downloads": -1, "filename": "rotunicode-1.1.2.tar.gz", "has_sig": false, "md5_digest": "55421b38cf5d54f2bbbdcc7690ff28bc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9138, "upload_time": "2014-08-29T22:43:12", "url": "https://files.pythonhosted.org/packages/0c/93/10f629a6c0847023d70a5b2766ec5c1780dd58f6c465c8a629357a57d8bf/rotunicode-1.1.2.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "7bad6e7548c3381c43a218da26b2b5f8", "sha256": "bb8844a12541e8bca7f26fdc3a4e62c38c66eac3e7124f68476a7bc85e64fdb6" }, "downloads": -1, "filename": "rotunicode-2.0.0.tar.gz", "has_sig": false, "md5_digest": "7bad6e7548c3381c43a218da26b2b5f8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8819, "upload_time": "2014-09-01T01:39:27", "url": "https://files.pythonhosted.org/packages/76/9a/43fdd039dfea351d22548955e1fa83cbf02a33a6191a215fe72c4b3ae9ed/rotunicode-2.0.0.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "7e0a9692ac59dfa77ac64c827051a168", "sha256": "c022bbdb3ab1437fd4abf521c8593ced691210be5f8aa47debefbb87f99119e6" }, "downloads": -1, "filename": "rotunicode-2.1.0.tar.gz", "has_sig": false, "md5_digest": "7e0a9692ac59dfa77ac64c827051a168", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14437, "upload_time": "2015-01-08T02:11:07", "url": "https://files.pythonhosted.org/packages/34/91/02840af0769d18933293224ec46f8f0338afdb835fd9c08e7f956be59da3/rotunicode-2.1.0.tar.gz" } ], "2.2.0": [ { "comment_text": "", "digests": { "md5": "ce397a62dfd106779fe43000cc0e144d", "sha256": "b5d188ed37bcd76392806c29aada8159d262e449c8263d4514acce17fd71e095" }, "downloads": -1, "filename": "rotunicode-2.2.0.tar.gz", "has_sig": false, "md5_digest": "ce397a62dfd106779fe43000cc0e144d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15244, "upload_time": "2015-01-12T05:09:27", "url": "https://files.pythonhosted.org/packages/d5/78/bda4ddaaaf6e458539054931e0fe87c8bd3f54749d500bde7d1e5cf8c7cd/rotunicode-2.2.0.tar.gz" } ], "2.3.0": [ { "comment_text": "", "digests": { "md5": "3a9a73bc75d32d7d49c47404918558a3", "sha256": "c5857185c2b3936f74090cbc04c7cda89593e1b4869156b67781268b8ce1dc68" }, "downloads": -1, "filename": "rotunicode-2.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3a9a73bc75d32d7d49c47404918558a3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12847, "upload_time": "2019-01-29T04:42:25", "url": "https://files.pythonhosted.org/packages/c1/38/51fe998233934d5e1cf0dd2673253300ee094673f8cf5d2119cf53598f3b/rotunicode-2.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2dd5868d2f24ec6275374101d1adafd6", "sha256": "080f0cf13a2adfbd23b574b34df1c81279fc1a04006e6dfa75610cde691403cf" }, "downloads": -1, "filename": "rotunicode-2.3.0.tar.gz", "has_sig": false, "md5_digest": "2dd5868d2f24ec6275374101d1adafd6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15150, "upload_time": "2019-01-29T04:42:28", "url": "https://files.pythonhosted.org/packages/0c/ba/9c424818d955c8e9c2693d934c43a8dcfc93cbaa639621c2b4c1abec84c6/rotunicode-2.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3a9a73bc75d32d7d49c47404918558a3", "sha256": "c5857185c2b3936f74090cbc04c7cda89593e1b4869156b67781268b8ce1dc68" }, "downloads": -1, "filename": "rotunicode-2.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3a9a73bc75d32d7d49c47404918558a3", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 12847, "upload_time": "2019-01-29T04:42:25", "url": "https://files.pythonhosted.org/packages/c1/38/51fe998233934d5e1cf0dd2673253300ee094673f8cf5d2119cf53598f3b/rotunicode-2.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "2dd5868d2f24ec6275374101d1adafd6", "sha256": "080f0cf13a2adfbd23b574b34df1c81279fc1a04006e6dfa75610cde691403cf" }, "downloads": -1, "filename": "rotunicode-2.3.0.tar.gz", "has_sig": false, "md5_digest": "2dd5868d2f24ec6275374101d1adafd6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15150, "upload_time": "2019-01-29T04:42:28", "url": "https://files.pythonhosted.org/packages/0c/ba/9c424818d955c8e9c2693d934c43a8dcfc93cbaa639621c2b4c1abec84c6/rotunicode-2.3.0.tar.gz" } ] }