matarrese/juniversalchardet

Detect from FileItem not working

Opened this issue · 0 comments

What steps will reproduce the problem?
1. if I use a fileinputstream it detects fine, if i use FileItem always detect 
maccrylic
2. atach you can see the example file
3.
 here is the peace of code:
BufferedWriter clsWriter = new BufferedWriter ( new OutputStreamWriter ( 
clsFile.getOutputStream () ) );

        clsWriter
                .write ( "ÄÜÖßäöü,Name1ÄÜÖßäöü,Name2ÄÜÖßäöü,Name3ÄÜÖßäöü,StreetÄÜÖßäöü,MÄÜÖßäöü,DE,80080,München,ContactÄÜÖßäöü,+49(0)ÄÜÖßäöü,ÄÜÖßäöü@gls-itservices.com,CommentÄÜÖßäöü,+49,(0)98,765,432,BlÄÜÖßäöü" );

        clsWriter.close ();

        InputStream clsInput = clsFile.getInputStream ();
        byte[] buffer = new byte[ 1024 ];

        while ( true )
        {
            int n = clsInput.read ( buffer );

            if ( n <= 0 )
            {
                break;
            }

            detector.handleData ( buffer, 0, n );

        }

        detector.dataEnd ();

        clsInput.close ();

        String strEncoding = detector.getDetectedCharset ();

        System.out.println ( "encoding: " + strEncoding );


What is the expected output? What do you see instead?
I expect latin-1

What version of the product are you using? On what operating system?
juniversalchardet-1.0.3.jar windowsxp

Please provide any additional information below.


Original issue reported on code.google.com by luisapme...@gmail.com on 23 Jul 2014 at 3:31

Attachments: