+ 7
Python convert codepage
Change codepage utf-8 to cp1251 I want console output 'hello привет' What I need to do? https://code.sololearn.com/c7YIZpbR9iIG/?ref=app
8 Respuestas
+ 9
I've been trying to solve that for Sololearn, but apparently there is a problem with the virtual machine it is running when on code playground - it can't produce proper output encoding to be read by the application.
+ 8
Yes, unfortunately you can't do anything about it. But in general you can include the following at the top of your script
#-*-coding:cp1251;-*-
+ 7
Martin to write so comment, is it best practice in python? If script codepage utf-8, do we need write it?
+ 7
shaldem No, usually you dont need to include it because utf-8 is standard
+ 3
same question ages ago...
https://www.sololearn.com/discuss/716083/?ref=app
+ 3
see it works:
https://code.sololearn.com/cPQASM4078YO/?ref=app
+ 1
use utf-16. it works.
+ 1
yuri utf-16 does't work too, the same exception