Skip to main content

Simplifies the encoding and decoding of Regional Indicator Symbols.

Project description

RISify

RISify is a Python library that provides functions for encoding and decoding Regional Indicator Symbols (RIS), which are Unicode characters used to represent flags of countries and regions.

Installation

You can install RISify via pip:

pip install RISify

Usage

from ris import ris

# decode a country code to RIS
pt = ris("PT")

print(pt)  # 🇵🇹

# decode an HTML code to RIS
de = ris("🇩🇪")
de = de.encode("unicode")  # default

print(de)  # 🇩🇪

# encode a RIS code to uppercase ASCII
nl = ris("🇳🇱")
nl = nl.encode("ascii")
nl = nl.upper()  # default

print(nl)  # NL

# encode a RIS code to lowercase ASCII
eu = ris("🇪🇺")
eu = eu.encode("ascii")
eu = eu.lower()

print(eu)  # eu

# encode a RIS code to HTML
fo = ris("🇫🇴")
fo = fo.encode("html")

print(fo)  # 🇫🇴

# concatenate RIS codes into a string
print("spam " + pt + " bacon " + de + " sausage " + nl + " eggs " + eu + " ham " + fo)
# spam 🇵🇹 bacon 🇩🇪 sausage NL eggs eu ham 🇫🇴

Note that HTML is encoded with HTML-safe symbols, which can be useful for ensuring that the symbols are markup-safe when used in HTML.

Contributing

Contributions are welcome! If you find a bug or have an idea for a new feature, please open an issue on the GitLab repository. If you would like to contribute code, please fork the repository and submit a pull request.

License

RISify is released under the GPLv3 license. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

RISify-1.1.0.tar.gz (16.0 kB view hashes)

Uploaded Source

Built Distribution

RISify-1.1.0-py3-none-any.whl (15.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page