coding: cp1252, coding: windows-1252 stop working

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gintare
    New Member
    • Mar 2007
    • 103

    coding: cp1252, coding: windows-1252 stop working

    OS: windows
    Python 3.3.5

    I am using characters like 'öÖäÄåÅąĄčČęĘėĖ įĮšŠųŲūŪžŽ' in my scripts and adding the script file the first line
    Code:
    # -*- 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?
  • stdq
    New Member
    • Apr 2013
    • 94

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

    Code:
    # -*- coding: utf-8 -*-
    Also, try changing the file encoding to UTF-8.

    Comment

    • dwblas
      Recognized Expert Contributor
      • May 2008
      • 626

      #3
      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.

      Comment

      • gintare
        New Member
        • Mar 2007
        • 103

        #4
        Thanks stdq. It have helped. I mean the line:
        Code:
        # -*- coding: utf-8 -*-

        Comment

        Working...