Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unsupported characters in input

I want to assign a string of characters to a variable but it says

: there isn't a "code to show.

I have a string that i want to assign to a variable

d="stunning:/ËstÊnɪÅ/"
Unsupported characters in input

or

word="stuning:/ˈstraɪkɪŋ/"
Unsupported characters in input

so basically the interpreter doesn't allow me to assign it to a variable, so I can't code on it.

How can I extract, delete those characters from the text, or is there anything to do , so python will support this kind of input.

I've tried to converted it into others format like ansi, utf, etc. but without success.

P.S.: I'm using python 2.7

like image 380
Alpagut Avatar asked Feb 02 '11 10:02

Alpagut


1 Answers

Set the source file encoding accordingly to the actual encoding of the file, so that the interpreter knows how to parse it.

For instance, if you use UTF-8, just add this string to the header of the file:

    # -*- coding: utf8 -*-

It must be the first or the second line of the file. See PEP 0263: Defining Python Source Code Encodings.

like image 60
Andrea Spadaccini Avatar answered Sep 30 '22 08:09

Andrea Spadaccini