jdunno / crunchy

Automatically exported from code.google.com/p/crunchy
0 stars 0 forks source link

Encoding problems #26

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Select French as a language option
2. Go to menu Didacticiel -> Utiliser Crunchy
3. Select the Editor
4. Run (Evaluer) the code in the box.

What is the expected output? What do you see instead?
We should see the first error line with an à à on it.  Instead a
question mark appears.

Note that this is obtained after a line 
# -*- coding: utf-8 -*-
has been inserted in all Python files and the coding in the ".po" files has
been changed to utf-8 as well.  The html page encoding has also been set to
the same value.

However, and this is the really puzzling feature, if in translation.py,
function build_dict(), we change the line from
        line = line.decode("utf-8")
to
        line = line.decode("latin-1")
then, the labels on the buttons are showing a wrong encoding BUT the error
line is showing the à (à) properly.

Original issue reported on code.google.com by andre.ro...@gmail.com on 4 Jan 2007 at 1:00

GoogleCodeExporter commented 8 years ago
Problem appears to be solved; and it may have been only a local one - but 
something
to keep in mind.   In order to deal with previous encoding issues related to 
the fact
that my home directory has some accented characters (i.e. in my name, André), 
I had
included in the Python path under the Lib directory the file sitecustomize.py 
with
the content
import sys
sys.setdefaultencoding('latin-1')
as this is the "natural" encoding for French.  By changing it to
import sys
sys.setdefaultencoding('utf-8')
the inconsistency disappeared and all the coding/decoding appears to be properly
done.  This may need to go in a FAQ at some point.

Original comment by andre.ro...@gmail.com on 4 Jan 2007 at 1:08

GoogleCodeExporter commented 8 years ago
Note that this solution was not a valid one, as it messed up other local 
programs
that depended on this site customization.  A different solution has been found 
which
involved decoding the output of the interpreter using the default encoding and
re-encoding it into utf-8.

Original comment by andre.ro...@gmail.com on 4 Jan 2007 at 3:36