Python Forum
how to print unicode in python?
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to print unicode in python?
#1
the goal is to have a 100% unicode system with utf-8 being used in any/every 8-bit or 9-bit (or up to 15-bit) stream/storage.  file names, file contents, internet connections, are typically 8-bit.  i once developed a 1-36 bit wrapper for the DECsystem-20 TOPS-20 system and IBM System-360 MVS and later did a 1-32 bit version for Linux (which compiled unchanged in Windows and worked compatibly).  anyway, back to unicode, utf-8, and python.  when might we have it so we just type in any unicode character in a text string (as a source code literal or as input() data).  python 4 ?

i want to be able to print() a text string with unicode characters in it and have it come out right (the correct datacodes when redirected to a file and the correct character displayed on a terminal screen or printer).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Read more about this.
Unicode HOWTO
Quote:Since Python 3.0, the language features a str type that contain Unicode characters,
meaning any string created using "unicode rocks!", 'unicode rocks!', or the triple-quoted string syntax is stored as Unicode.

The default encoding for Python source code is UTF-8, so you can simply include a Unicode character in a string literal:
Python 3 is all Unicode,problem can of course occurs because the outside world(OS,Files,Terminals,Files,Servers...)that are not all Unicode.
There has been massive discussion about this topic,
many correction has been made and Python 3.5 --> are really good(also talking with outside world).
Python 3 decision to make all Unicode was the right decision,we have to hope that it get better in the outside world.

Just a note all Shell/Terminal(Windows,Linux,Mac) can get correct arguments in Unicode into Python.
Bye using Click click.echo().
Quote:but it has improved support for handling Unicode and binary data
that does not fail no matter how badly configured the system is.

Primarily it means that you can print binary data as well as Unicode data on both 2.x and 3.x to the given file in the most appropriate way possible.
This is a very carefree function as in that it will try its best to not fail.
As of Click 6.0 this includes support for Unicode output on the Windows console.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  python-resize-image unicode decode error Pedroski55 3 3,400 Apr-21-2020, 10:56 AM
Last Post: Pedroski55
  [split] how to print unicode in python? Frank57 4 2,963 Oct-28-2019, 08:57 PM
Last Post: Frank57
  clean unicode string to contain only characters from some unicode blocks gmarcon 2 3,917 Nov-23-2018, 09:17 PM
Last Post: Gribouillis
  Python 2 Unicode question Skaperen 2 2,452 Sep-08-2018, 06:44 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020