[wingide-users] encoding problem

Wingware Support support at wingware.com
Tue Jun 5 13:07:56 MDT 2012

brian downing wrote:
> My default encoding was cp1252 on windows 7. I copied some html that 
> was utf-8 into unicode strings in a python script. In wingware I 
> changed the encoding to utf-8. I made a few changes to the file and 
> used my revision control to revert back to a pre-encoding change 
> version. Now in the source code I see weird characters. How should I 
> fix this?

Do you have a coding comment at the top of the source file?  I'd add 
that if it's not there, like this:


Then you'll have to retype/re-paste the corrupted characters.  It looks 
like Wing stored the file as utf-8 but the revision control system acted 
on it like it's cp1252.  I don't know if adding the coding comment in 
the file will prevent this in the future, but it's a good idea not to 
assume files matching system or IDE defaults.

Another idea would be to change the encoding in Wing back to cp1252 for 
that file and tell Wing to re-read it from disk, then add the coding 
comment after that.  That might be easier if more of the file contents 
is in cp1252 than in utf-8.

You could of course also save a copy of the file in each encoding then 
copy/paste content over or use Wing's diff/merge tool to compare and 
merge the files.


Stephan Deibel
Wingware | Python IDE
Advancing Software Development


More information about the wingide-users mailing list