Ex23- I've typed everything correctly but UTF-8 wont work and i keep getting errors! ):

the title says it all

i’ve printed out the code 5 times and i keep getting this printed back to me :

PS C:\Users\Sputnik34\lpthw> python ex23.py utf-8 strict
b’Afrikaans’ <===> Afrikaans
Traceback (most recent call last):
File “ex23.py”, line 23, in
main(languages, input_encoding, error)
File “ex23.py”, line 10, in main
return main(language_file, encoding, errors)
File “ex23.py”, line 9, in main
print_line(line, encoding, errors)
File “ex23.py”, line 18, in print_line
print(raw_bytes, “<===>”, cooked_string)
OSError: [WinError 87] The parameter is incorrect
Exception ignored in: <_io.TextIOWrapper name=’’ mode=‘w’ encoding=‘utf-8’>
OSError: [WinError 87] The parameter is incorrect

i don’t know what’s wrong :’(

Hmm. That’s a cryptic one.

Can you try to print out raw_bytes and cooked_string separately to see which one makes Python choke?

Does this happen with every encoding that you pass to the script or only with utf-8?

Also, it would be helpful to see your code.

Paste your code here doing this:

# your code here

Then I can take a look. Also, what computer are you using and what is your computer’s native language setting?