By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,991 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,991 IT Pros & Developers. It's quick & easy.

coding: cp1252, coding: windows-1252 stop working

100+
P: 103
OS: windows
Python 3.3.5

I am using characters like 'ąĄčČęĘėĖįĮųŲūŪ' in my scripts and adding the script file the first line
Expand|Select|Wrap|Line Numbers
  1. # -*- coding: cp1252 -*-
Currently i start getting the error: "Invalid encoding cp1252" when i try to save the file.
And error "encoding problem: windows1252 with BOM" when i try to run the file.


I also have tried other encodings like:
cp-1252
windows-1252
windows1252

What i can do. How to use characters 'ąĄčČęĘėĖįĮųŲūŪ' in my script?
Oct 3 '14 #1

✓ answered by stdq

Hi! I'm not sure, but this might help: try changing your line of code to

Expand|Select|Wrap|Line Numbers
  1. # -*- coding: utf-8 -*-
Also, try changing the file encoding to UTF-8.

Share this Question
Share on Google+
3 Replies


P: 94
Hi! I'm not sure, but this might help: try changing your line of code to

Expand|Select|Wrap|Line Numbers
  1. # -*- coding: utf-8 -*-
Also, try changing the file encoding to UTF-8.
Oct 3 '14 #2

Expert 100+
P: 614
A simple search came up with Mapping Windows CP1252 Gremlins to Unicode so it is almost certain that there are additional sites from people who have already solved this problem. Pick the one you like best as there is no point in reinventing the wheel here.
Oct 3 '14 #3

100+
P: 103
Thanks stdq. It have helped. I mean the line:
Expand|Select|Wrap|Line Numbers
  1. # -*- coding: utf-8 -*-
Oct 4 '14 #4

Post your reply

Sign in to post your reply or Sign up for a free account.