Menu

encoding - pydev

2009-06-09
2013-03-15
  • Ozan HACIBEKIROGLU

    I am a new python begginer and I have a confusing problem.

    I use pydev for my applications and when I run application from eclipse It works great BUT when I run it with original Python IDE, I got the error message below:

    "UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3"

    I could not understand what I am doing wrong, please help me as soon as possible

    (In my applications unicode is a MUST because of my language :) )

     
    • Brandon

      Brandon - 2009-06-09

      You will want to add this line to the top of your files:

      # -*- coding: utf-8 -*-

      If you have the normal shbang at the top (#!/usr/bin/...) then add it right after that

      You may also want to check out http://evanjones.ca/python-utf8.html

      -Brandon

       
    • Ozan HACIBEKIROGLU

      Thanks Brandon

      I did it but it did not help. After a research I learnt something and changed my "site.py" file. I just changed the default character encoding from ascii to utf8. It solved everything and I have no problem now. However, I dont know what this dangerous change will bring :)

       
      • liturgist

        liturgist - 2009-06-10

        When in doubt, you might try:

        import sys
        print sys.stdout.encoding