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 7010961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:04:00+00:00 2026-05-27T22:04:00+00:00

I am using Xcode 4.2 and IDLE under Mac OS 10.7 to compile Python

  • 0

I am using Xcode 4.2 and IDLE under Mac OS 10.7 to compile Python 3 code, which is as follows:

#coding=utf-8
print("ľťď")

In spite of using the same interpreter, which is python 3.2.2, while IDLE returns the expected string ľťď (in fact, it works even without the first line—if I understand correctly, this version of Python uses utf-8 as default encoding), Xcode returns an error:

Traceback (most recent call last):
  File "/Users/.../main.py", line 2, in <module>
    print("\u013e\u0165\u010f")
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)

How can I achieve the same output in Xcode, please?

  • 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-27T22:04:00+00:00Added an answer on May 27, 2026 at 10:04 pm

    I have found the solution thanks to this article.

    In case you experience the same issue, all you have to do is create a standard XML property list ~/.MacOSX/environment.plist (case sensitive, extension sensitive) with the key of PYTHONIOENCODING and string value utf-8. Do not forget to log out and log in before testing.

    For more details, you may found these articles useful:

    http://docs.python.org/using/cmdline.html#envvar-PYTHONIOENCODING

    http://developer.apple.com/library/mac/#qa/qa1067/_index.html

    environment.plist

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>PYTHONIOENCODING</key>
        <string>utf-8</string>
    </dict>
    </plist>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Python 3.2.2 in Xcode 4.2 (build 4D199) on Mac OS X
I'm trying to run Python scripts using Xcode's User Scripts menu. The issue I'm
Im using Xcode and c++ I have copied the HoughCircles code from the OpenCV
I am using Xcode to create an Objective-C, cocoa, mac app. I have a
Using XCode 4.2, I am using the static analyser on code similar to the
I am using Xcode. I have implemented the shake code. Now I want to
I'm using XCode 3 to develop MAC and iPhone apps. Because I'm thinking of
I'm using Xcode 3.2.3 on Mac OS X 10.6.6 on a Mac Pro to
I am using XCode 3.2.6 on an Intel Mac running OS X 10.6, to
Using Xcode 4.2 and ARC, I wrote the following code before I had any

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.