G
gialloporpora
Dear all,
I have a strange problem that I am not able to solve myself.
I have written a little Python script to download image from last.fm,
now, if I call it from the python environment it works, if I call it
from Windows console it doesn't works
If I open the prompt and run python I call the function:
(the code is at the end of message)I obtain this result:
%C3%A9
that is the correct output.
if I open the windows console (cmd) without enter in Python envinroment,
and I call script from commandline:
lastfm.py é
the result is:
%C3%9A
that is not the same and I don't understand the reason.
If I give the command : chcp from console I have:
Active code page: 850
the same code table that I see using the sys.stdin.encoding inside
Python envinroment.
Someone know where I make wrong ?
Thanks
Sandro
My code (only the parts that not works)
======================
import sys
from urllib import quote_plus
def decodeArgs(s):
return quote_plus(s.decode(sys.stdin.encoding).encode("utf-8"))
if __name__ == '__main__':
args=sys.argv[1]
print decodeArgs(args)
======================
I have a strange problem that I am not able to solve myself.
I have written a little Python script to download image from last.fm,
now, if I call it from the python environment it works, if I call it
from Windows console it doesn't works
If I open the prompt and run python I call the function:
(the code is at the end of message)I obtain this result:
%C3%A9
that is the correct output.
if I open the windows console (cmd) without enter in Python envinroment,
and I call script from commandline:
lastfm.py é
the result is:
%C3%9A
that is not the same and I don't understand the reason.
If I give the command : chcp from console I have:
Active code page: 850
the same code table that I see using the sys.stdin.encoding inside
Python envinroment.
Someone know where I make wrong ?
Thanks
Sandro
My code (only the parts that not works)
======================
import sys
from urllib import quote_plus
def decodeArgs(s):
return quote_plus(s.decode(sys.stdin.encoding).encode("utf-8"))
if __name__ == '__main__':
args=sys.argv[1]
print decodeArgs(args)
======================