Issue1487

classification
Title: Import of module with latin-1 chars fails on utf-8 file encoding
Type: behaviour Severity: normal
Components: Core Versions: 2.5.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: artichoke, pjenvey
Priority: Keywords:

Created on 2009-10-08.05:07:52 by artichoke, last changed 2009-10-20.04:25:47 by pjenvey.

Messages
msg5224 (view) Author: (artichoke) Date: 2009-10-08.05:07:48
Where default file encoding is utf-8, "import tarfile" fails with
MalformedInputException because of the a with diaeresis in that file.

It can be fixed by using an 8-bit compatible encoding while looking for
the coding: comment.  Changing line 79 to read:

        BufferedReader br = new BufferedReader(new
InputStreamReader(stream, "ISO-8859-1"), 512);

fixes the problem.

sun.io.MalformedInputException
        at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:278)
        at
sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:316)
        at
sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:366)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:252)
        at java.io.InputStreamReader.read(InputStreamReader.java:212)
        at java.io.BufferedReader.fill(BufferedReader.java:157)
        at java.io.BufferedReader.readLine(BufferedReader.java:320)
        at java.io.BufferedReader.readLine(BufferedReader.java:383)
        at org.python.core.ParserFacade.findEncoding(ParserFacade.java:411)
        at org.python.core.ParserFacade.readEncoding(ParserFacade.java:391)
        at org.python.core.ParserFacade.prepBufReader(ParserFacade.java:301)
msg5225 (view) Author: (artichoke) Date: 2009-10-08.05:10:58
That is line 79 of ParserFacade.java
msg5226 (view) Author: (artichoke) Date: 2009-10-08.05:12:29
Ok, the lack of sleep is getting to me.  Line 390 of ParserFacade.java.
msg5238 (view) Author: Philip Jenvey (pjenvey) Date: 2009-10-20.04:25:47
Next time just attach a patch so you don't have to argue with yourself 
over the line number =P

fixed in r6886, thanks!
History
Date User Action Args
2009-10-20 04:25:47pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg5238
nosy: + pjenvey
2009-10-08 05:12:30artichokesetmessages: + msg5226
2009-10-08 05:10:59artichokesetmessages: + msg5225
2009-10-08 05:07:53artichokecreate