Pb encodage & import

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michel Claveau - abstraction méta-galactique non t

    #1

    Pb encodage & import

    Bonsoir ! Hi !

    My english is short, therefore, I do short.

    Two scripts, "i1.py" and "i2.py" :

    i1.py :
    import i2
    print i2.GlobalA

    i2.py :
    GlobalA ="azerty"




    Like this, it's OK ; but :



    i1.py :
    import i2
    print i2.GlobalA

    i2.py :
    GlobalA = "azerty"

    OK

    =============== ===============

    i1.py :
    import i2
    print i2.GlobalA

    i2.py :
    # -*- coding: cp1252 -*-

    GlobalA = "azerty"

    SyntaxError

    =============== ===============

    i1.py :
    import i2
    print i2.GlobalA

    i2.py :
    # -*- coding: utf-8 -*-

    GlobalA = "azerty"

    OK

    =============== ===============

    i1.py :
    # -*- coding: utf-8 -*-

    import i2
    print i2.GlobalA

    i2.py :
    # -*- coding: utf-8 -*-

    GlobalA = "azerty"

    OK

    =============== ===============

    i1.py :
    # -*- coding: utf-8 -*-

    import i2
    print i2.GlobalA

    i2.py :
    # -*- coding: cp1252 -*-

    GlobalA = "azerty"

    SyntaxError

    =============== ===============

    i1.py :
    # -*- coding: utf-8 -*-

    import i2
    print i2.GlobalA

    i2.py :
    GlobalA = u"azérty" #see unicode & accent

    OK

    =============== ===============

    i1.py :
    # -*- coding: utf-8 -*-

    import i2
    print i2.GlobalA

    i2.py :
    # -*- coding: utf-8 -*-

    GlobalA = u"azérty" #see unicode & accent

    UnicodeDecodeEr ror

    =============== ===============


    All files are recorded in ANSI ; tests with Python 2.4 on Win-XP.



    Ideas, ou suggests ?




    @-salutations
    --
    Michel Claveau





  • Michel Claveau - abstraction méta-galactique non t

    #2
    Re: Pb encodage & import

    Hi !

    Wilk had give me a solution pour UnicodeDecode Error.
    But no ideas for other problems.




    Comment

    Working...