Code Playground encoding (UTF-8) problem | Sololearn: Learn to code for FREE!


Code Playground encoding (UTF-8) problem

Guys, has anyone tried to remedy the encoding issue in SL and succeeded? I've been trying to do sth about it, but never managed to actually solve it. The encoding part is fine. It seems that when I try to decode and print it out, it fails, raising an exception (tough!) I recently wrote a code on retrieving new company data from the Polish business registry and of course the data there contains lots of our local letters. The output is illegible without them...

3/9/2018 6:29:40 PM

Kuba Siekierzyński

9 Answers

New Answer


@Kuba have you looked into Unicode characters?


@Ace, my man, thanks for the tip :) Inspired by your code, I dug a bit into this and found out it's not that simple to manipulate with system encoding (which amazingly is cp1252 instead of utf-8 in the CP). BUT, I've taken a more elegant approach now. If I can't change it, at least I give the user a heads up ;)


Thanks @!` ;)


@Hasan Yep, tried that, but doesn't work in SL 🤔


@Brains Thanks for sharing anyway :)


@Sean-Michael My workaround kind of works for now. If I can't change the system encoding on Windows virtual machine in the Code Playground, there's little I can do inside Python there. The system will simply not produce the chars I need as it doesn't know how to handle and display them. I remember that waaaay ago when programming in Pascal, there was a way to overwrite standard ASCII table and define your own 8x16 pixel chars replacing them (even beyond run-time). Perhaps there is a way to do it in Python, too? (although even if so, CP probably does not include this module 😂)


s = vivodships.decode('utf8').encode('latin1').decode('utf8')


Hi Kuba, Because I was interested in playing with UTF-8 characters to produce AsciiArt things, I wrote about the limitations to SL dev team. They answered on February 1, 2018 : " We are working to improve the Code Playground ", To be continued ...