Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (Retired) Shopping List Lists and Strings

Bjarke Mønsted
Bjarke Mønsted
3,317 Points

Using international chars in a variable?

I used my middlename "Mønsted" in this challenge, and it kept coming up with error, until I changed it to "Monsted" instead. Is this normal behavior or should I do some additional formatting?

full_name = 'Bjarke Monsted Laursen'
name_list = full_name.split(' ')

1 Answer

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

Wow! That's unfortunate. The challenge checker clearly isn't using utf-8. I've tried your example with various character encoding declarations found in PEP 263, but none seemed to convince the checker to accept your ø.

Python 3 default encoding is utf-8:

$ python3
Python 3.4.0 (default, Apr 11 2014, 13:05:11) 
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.getdefaultencoding())

Though Python 2 default encoding is ascii:

$ python2
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print(sys.getdefaultencoding())

Tagging Kenneth Love for comment