Re: [rules-users] A little suggestion about the 'ResourceFactory', 'DrlParser' API

2011-11-10 Thread Bruno Freudensprung


Maybe there is something I don't understand, but I also have the 
impression that encoding management is strange in Drools.


The "lexer = new DRLLexer( new ANTLRInputStream( is ) );" line indeed 
leads to using the default encoding of the machine.


It is the same for the CSV parser (rule templates, Drools 5.1.1):

public void parseFile(final InputStream inStream) {
final BufferedReader reader = new BufferedReader(new 
InputStreamReader(inStream));


It means that if I write my rule on a Windows machine (CP1252) and 
deploy it on a Linux server (UTF-8), it will not work as expected.


Conditions like...:
Person(firstname == "Béatrice")

... will become things like (CP1252 file "transported" onto a UTF-8 
platform and read as UTF-8) :

Person(firstname == "B¤atrice")

I wonder how you deal with that in Guvnor.

Best regards,

Bruno.

Le 10/11/2011 06:47, Miles Wen a écrit :
Would you please provide a method in 'org.drools.io.ResourceFactory' 
like this:


public static Resource newReaderResource(InputStream stream, String 
encoding);


then I can use this method to load drl files as a stream while 
explicitly specify its ecoding?


And in line: 287 of class 'org.drools.compiler.DrlParser':

lexer = new DRLLexer( new ANTLRInputStream( is ) );

no encoding specified as well. The ANTLRInputStream has constructors 
which allows you to specify the encoding, otherwise it would figure 
out the encoding according to the environment, which is unpredictable 
some times.


I'm using drools 5.3.0, the newest version. Thosse problems exists for 
quite a while during previous versions. I'm fainting to see they are 
almost there after upgraded to the new version.


--
Regards.
Miles. Wen


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


[rules-users] A little suggestion about the 'ResourceFactory', 'DrlParser' API

2011-11-09 Thread Miles Wen
Would you please provide a method in 'org.drools.io.ResourceFactory' like
this:

public static Resource newReaderResource(InputStream stream, String
encoding);

then I can use this method to load drl files as a stream while explicitly
specify its ecoding?

And in line: 287 of class 'org.drools.compiler.DrlParser':

lexer = new DRLLexer( new ANTLRInputStream( is ) );

no encoding specified as well. The ANTLRInputStream has constructors which
allows you to specify the encoding, otherwise it would figure out the
encoding according to the environment, which is unpredictable some times.

I'm using drools 5.3.0, the newest version. Thosse problems exists for
quite a while during previous versions. I'm fainting to see they are almost
there after upgraded to the new version.

-- 
Regards.
Miles. Wen
___
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users