<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<br>
Maybe there is something I don't understand, but I also have the
impression that encoding management is strange in Drools.<br>
<br>
The "<tt>lexer = new DRLLexer( new ANTLRInputStream( is ) );</tt>"
line indeed leads to using the default encoding of the machine.<br>
<br>
It is the same for the CSV parser (rule templates, Drools 5.1.1):<br>
<br>
<tt> public void parseFile(final InputStream inStream) {<br>
final BufferedReader reader = new BufferedReader(new
InputStreamReader(inStream));<br>
</tt><br>
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.<br>
<br>
Conditions like...:<br>
<tt>
Person(firstname == "Béatrice") <br>
</tt><br>
... will become things like (CP1252 file "transported" onto a UTF-8
platform and read as UTF-8) :<br>
<tt> Person(firstname == "B¤atrice")<br>
</tt>
<br>
I wonder how you deal with that in Guvnor.<br>
<br>
Best regards,<br>
<br>
Bruno.<br>
<br>
Le 10/11/2011 06:47, Miles Wen a écrit :
<blockquote
cite="mid:CAJZuUJDokfJd0WNDvQHwU43kwn7wiTz9H_O9Vo=xBX9cWM8=Eg@mail.gmail.com"
type="cite">Would you please provide a method in
'org.drools.io.ResourceFactory' like this: <br>
<br>
public static Resource newReaderResource(InputStream stream,
String encoding);<br>
<br>
then I can use this method to load drl files as a stream while
explicitly specify its ecoding? <br>
<br>
And in line: 287 of class 'org.drools.compiler.DrlParser': <br>
<br>
lexer = new DRLLexer( new ANTLRInputStream( is ) );<br>
<br>
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.<br>
<br>
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.<br
clear="all">
<br>
-- <br>
Regards.<br>
Miles. Wen<br>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</body>
</html>