Python Forum
i thought everything was utf-8 in python3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
i thought everything was utf-8 in python3
#10
i still don't know, for this website, how to quote a post and break it into pieces to do split replies.  so i will just answer by "quoting" text by typing it or doing copy/paste.   errors can easily happen.

this is a script just for testing stuff.  i do not commit time for good code in this case.  that's one reason the dictionsry file name is hardcoded in the source.

this is going off from the original program.  the original has a failure that was not obvious to me.  so i do th "make minimal example".  usually that means i copy the original to a new name (forked if i am keeping it under my revision control system, which is rare) and reduce it in steps, keeping the original error.  this can be messy process and many things remain just because it didn't get there or was not sure.  that's one reason why those two lines you suggested i remove were there.  another is that i was testing python 2, too.  but, no longer.  so, out they go.

as for errors i think str.encode() is a big culprit.  it may end up being argued that this kind of thing should never be a string.

having args in main is just another leftover.  i don't worry about for now.  it's not in the very minimal code (testutf.py)

i am going to have trouble doing a couple of those commands you gave me as my shell (bash 4.3.46(1)) does not seem to properly handle utf-8 input.  it may be the gnu readline thing doing this.  i just did a test and it appears to be a readline issue.

i am seeing reasons for separating a lot of this stuff.  but i need a way to print the utf-8 stuff i have without it being modified.  doing print() of bytes just gets the equivalent of repr() to run.  so print('abc'.encode() gets b'abc' (just tried it on repl.it).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: i thought everything was utf-8 in python3 - by Skaperen - Jan-23-2017, 08:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Gnuradio python3 is not compatible python3 xmlrpc library How Can I Fix İt ? muratoznnnn 3 5,049 Nov-07-2019, 05:47 PM
Last Post: DeaD_EyE
  Printing from a text file not working as I thought it would PythonZenon 10 6,316 Jun-02-2018, 09:19 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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