[exim] Solved : Re: transport filter with know charset enco…

Pàgina inicial
Delete this message
Reply to this message
Autor: Cyborg
Data:  
A: exim-users
Assumptes vells: Re: [exim] transport filter with know charset encoding
Assumpte: [exim] Solved : Re: transport filter with know charset encoding

Am 26.08.2013 16:06, schrieb Phil Pennock:
> On 2013-08-26 at 15:48 +0200, Cyborg wrote:
>> is there anychance, that a transportfilter gets knowlage about the
>> messages charset before it is processed ?
> There is no such thing as a "message charset".


I was refering to the Content-Type: header, which if present, would be
nice to know before opening the stdin on the transport filter.

and to be clear, it's a java problem. Entirely. It would have been
helpfull, if it would have been possible to have the content-type on
startup of the transport filter. Thats all.

Problem solved :

If you ever have the same problem in java ( reopening the system.in with
another encoding ) do this:

Instead of using "BufferedReader ins = new BufferedReader(new
InputStreamReader( System.in ) );"

use :

                         InputStream dis = System.in;
                         dis.mark(0);


                         BufferedReader ins = new BufferedReader(new 
InputStreamReader( dis ) );
                            boolean streamreset = false; // prevent 
endless reopenings ..
                         ... while () { ...


                                                         if ( 
!charset.equals("none") && !charset.toLowerCase().equals("utf-8") && 
!streamreset ) {


dis.reset(); // back to position zero

                                                                 ins = 
new BufferedReader(new InputStreamReader( dis, charset ));
streamreset = true;
                                                         }
                         } ....


hint: don't forget to reset your already parsed variables.


Marius