This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Unexpected results in Tutorial about Unicode
Type: behavior Stage:
Components: Unicode Versions: Python 3.0
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Viscaynot, georg.brandl, loewis
Priority: normal Keywords:

Created on 2007-09-03 03:36 by Viscaynot, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (5)
msg55598 - (view) Author: Vizcaynot (Viscaynot) Date: 2007-09-03 03:36
When trying the tutorial example about unicode  I have:
>>> "Äpfel".encode('utf-8')
  File "<stdin>", line 1
SyntaxError: (unicode error) unexpected code byte

I live in a latin american country so I need to do:
>>> "Äpfel".decode('latin-1).encode('utf-8')
  File "<stdin>", line 1
but the indentation "     >>>" is new for me, so I attempt the next:
>>> a="Äpfel".decode('latin-1).encode('utf-8')
  File "<stdin>", line 1
    >>> a
>>> print (a)

Is this necessary to do correction to the tutorial? is this normal the 
presence of "   >>>" that appears indented once I assign the value to 
variable a?
msg55603 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-09-03 07:08
Vizcaynot schrieb:
> New submission from Vizcaynot:
> When trying the tutorial example about unicode  I have:
>>>> "Äpfel".encode('utf-8')
>   File "<stdin>", line 1
> SyntaxError: (unicode error) unexpected code byte

This is definitely a bug. Assigning to Martin to investigate.
msg55634 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-09-04 09:23
The first issue (non-ASCII characters won't work in interactive mode)
was reported as issue 1100 also, and is now fixed in r57957.

As for the other issues, I'm not quite sure what to make out of them - I
see a different behavior:

py> "Äpfel".decode('latin-1).encode('utf-8')
  File "<stdin>", line 1
SyntaxError: invalid syntax

This is not surprising - 'latin-1 is missig a closing quotation mark.

I'm not sure where the indentation comes from, it is not supposed to be
there, and I don't see it on my machine.

What operating system, Python version, and interactive mode (shell or
IDLE) are you using?

[unassigning myself - the certain bug has been fixed]
msg55650 - (view) Author: Vizcaynot (Viscaynot) Date: 2007-09-04 23:11
Thanks about the fixing info.
In relation to the second issue, I am afraid it is my fault, the value 
of variable "a" was asigned and filled with a previous valid operation. 
Please forgive me for the time you spent unnecessarily. I will attempt 
to be careful in the future.  :-(
msg55656 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2007-09-05 06:16
OK, closing.
Date User Action Args
2022-04-11 14:56:26adminsetgithub: 45433
2007-09-05 06:16:24georg.brandlsetstatus: open -> closed
resolution: fixed
messages: + msg55656
2007-09-04 23:11:40Viscaynotsetmessages: + msg55650
2007-09-04 09:23:43loewissetassignee: loewis ->
messages: + msg55634
2007-09-03 07:08:04georg.brandlsetassignee: loewis
messages: + msg55603
nosy: + georg.brandl, loewis
2007-09-03 03:36:47Viscaynotcreate