1

I am working with Python3. Analyzing some websites I came across some weird characters and looked for a solution. I found one but until I found that solution I tried a few things and know I cannot reset it. When I use my Jupyter notebook saving the list l=[1,2,3,4] to a file leads '΀煝⠀ŋɋ͋ы⹥'

I may have done

chcp 65001 set PYTHONIOENCODING=utf-8 

How can I reset my settings? Or how can I find out whats going on?

2
  • can you please rephrase the question? it is very confusing about what you were trying to do. is it saving the file using correct encoding? or is it display characters correctly on console? Commented Jun 12, 2017 at 2:33
  • A Jupyter notebook is a web interface to a kernel running in a parent Python process. In the notebook client process, stdin is a pipe and stdout/stderr are ipykernel.iostream.OutStream objects that use UTF-8 and have nothing to do with the console. So why are you running chcp.com? Exactly what operations did "saving the list l=[1,2,3,4]" entail? Commented Jun 12, 2017 at 7:37

2 Answers 2

1

When you open a file for reading or writing, always explicitly specify the encoding you want to use, e.g. encoding="utf-8". Do that and the default codepage will have no effect on your file i/o.

Sign up to request clarification or add additional context in comments.

2 Comments

I reset the chcp to 850. This has no effect. Specifying encoding="utf-8" or encoding="ansii" also seems to have no effect. Anything other that I can try?
Yes: Make a tiny program that only "saves the list l=[1,2,3,4] to a file", then reads it back in and prints it. Then edit your question and include the code, and the output.
0

You have change your code page and know, you need to change it back to initial value. So, Try reset you code page number to its default value, US by:

chcp 437 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.