my string is already in UTF-8 form. that is, 1 to 6 byte codes (octets) in sequence per character and the codes are in range(256) (could have been in bytes but is in str). how do i tell the print function in Python3 and the print command in Python2 that the string is already in UTF-8 form? does converting it to bytes first, help to print it right? do i need to set environment variable LC_ALL to some value?
that article did not cover UTF-8 at all, and did not convince me to stay with Python2/
but, i figured out that all i need to do is output UTF-8 via os.write()
.
(Aug-17-2018, 02:43 AM)Skaperen Wrote: [ -> ]but, i figured out that all i need to do is output UTF-8 via os.write()
.
Is not
os.write()
used to write content to files?
it depends on which file descriptor you write to. the process inherits file descriptors 0,1,2 from the shell that starts it. in the POSIX/Unix/Linux world, 0 is stdin, 1 is stdout, 2 is stderr. as i understand it, where Windows implements these functions it does it the same way. if you open "/dev/tty", you get a new file descriptor (3 or higher). open it for output and write to it and the output goes to the emulated terminal.