Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6132267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:04:52+00:00 2026-05-23T17:04:52+00:00

#!/usr/bin/env python # -*- coding: utf8 -*- print 私 print u私 the result: ç§

  • 0
#!/usr/bin/env python
# -*- coding: utf8 -*-
print "私"
print u"私"

the result:

ç§
UnicodeEncodeError: 'ascii' codec can't encode character u'\u79c1' in position 0: ordinal not in range(128)

Or, in Idle for both u”私” and “私”:

>>> print "私"
Unsupported characters in input

I’ve followed all the advice I could find which says that I have to put the “coding” line under the shebang. All my web-browsers display kanji fine, and I can type it fine. But this garble comes out when I try and use it in Python 🙁 Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:04:53+00:00Added an answer on May 23, 2026 at 5:04 pm

    You need a terminal or IDE that supports UTF8, or at least an encoding that supports Japanese. PythonWin, from the Pywin32 extension library, is an IDE that will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#!/usr/bin/env python # -*- coding: UTF-8 -*- # enable debugging import cgitb cgitb.enable() print
#!/usr/bin/env python # -*- coding: utf-8 -*- from sqlalchemy import create_engine connection = create_engine('mysql://user:passwd@localhost:3306/db').connect()
#!/usr/bin/env python # -*- coding: utf-8 -*- import re text = aaaa[ab][cd][ef] a =
#!/usr/bin/env python import os, sys, subprocess, time while True: print subprocess.call(xsel, shell=True); time.sleep(1); Takes
The code #!/usr/bin/env python import MySQLdb print Content-Type: text/html print print <html><head><title>Books</title></head> print <body>
Here's a little program: #!/usr/bin/env python # -*- encoding: utf-8 -*- print('abcd kΩ ☠
This is my Python program: #!/usr/bin/env python import os BASE_PATH = os.path.dirname(__file__) print BASE_PATH
I'm trying to learn the classes in python: #!/usr/bin/env python # *-* coding: utf-8
#!/usr/bin/env python # -*- coding: utf-8 -*- import curses screen = curses.initscr() curses.noecho() curses.curs_set(0)
The following test fails: #!/usr/bin/env python def f(*args): >>> t = 1, -1 >>>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.