Skip to main content

A printer suppressing UnicodeEncodeError

Project description

A printer suppressing UnicodeEncodeError.

Install

pip install safeprint

Usage

Basic:

from safeprint import print

print("你好世界!" "こんにちは世界" "안녕하세요세계")

Hook callback:

import safeprint

printer = safeprint.Printer()

def callback(text):
        # do something with the text

printer.add_listener(callback)

printer.print(1, 2, 3, sep=", ")

Dependencies

  • win-unicode-console - required if python version < 3.6.

Dev-dependencies

  • bumpr

  • wheel

  • docutils

  • twine

  • setuptools

Performance note

  • BasePrinter - Use builtins.print. Python has builtin unicode support after Python 3.6.0.

  • EchoPrinter - Call echo command to print unicode chars. Extreme slow.

  • TryPrinter - Print each chars separately and print a “?” for invalid char.

  • WinUnicodePrinter - Use win-unicode-console module.

Changelog

  • 0.1.4 (Dec 31, 2016)

    • Make win-unicode-console optional with Python 3.6.

  • 0.1.2 (Jul 21, 2016)

    • Compatible with win-unicode-console 0.5

  • 0.1.1 (Apr 15, 2016)

    • Fix builtins bug.

  • 0.1.0 (Apr 15, 2016)

    • Initial release.

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

safeprint-0.1.4.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

safeprint-0.1.4-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file safeprint-0.1.4.tar.gz.

File metadata

  • Download URL: safeprint-0.1.4.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for safeprint-0.1.4.tar.gz
Algorithm Hash digest
SHA256 f7b1d32a5acb2c975f1005cba7d3bf6a3750e887c35704a3846ff4614ebd46e9
MD5 821858cac2b9d3707c5c1a91ae3be478
BLAKE2b-256 cc8acd1f693e5300a47ef5ea69856421205196be976ee7afe2f650535d0036e8

See more details on using hashes here.

File details

Details for the file safeprint-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for safeprint-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7bd363806f19dc8a99247a7fb062ec986561284d6933c6354c78b3c9d10cea18
MD5 275c935e9c0f0f40ff6afb2dfea145ab
BLAKE2b-256 1c38c879a3972378a5f0827d9d75133b224a5ac3bf73c8c5893026c280861c23

See more details on using hashes here.

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