Greetings,<br><br>I am having some issues with encoding in my rules. I am using a drl like this:<br><br><span style="font-family: courier new,monospace;">package pt.xpto.mydroolstest</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">import pt.xpto.model.SimpleFact</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">import pt.xpto.model.SimpleResult</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">import java.util.ArrayList</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">import java.util.Collection</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">global Collection results</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">rule 'first-rule'</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">when</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> SimpleFact(description=="someDescription", value < "500") and</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> SimpleFact(description=="anotherDescription", value=="1");</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">then</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> SimpleResult result = new SimpleResult(); </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ArrayList aList= new ArrayList();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> result.setDescription("Some String with portuguese chars like ç and à");</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> aList.add("Another String with portuguese chars like é and ã."); </span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> result.setValue(aList);</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> results.add(result);</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">end</span><br style="font-family: courier new,monospace;">
<br><br>My problem is that when i retrieve the results from firing the rules, the encoding of the strings with the portuguese chars is all messed up. From the tests i did, this happens when the rules are compiled by drools. <br>
<br>If i make the following modification to the rules<br><br> <span style="font-family: courier new,monospace;"> result.setDescription(new String("Some String with portuguese chars like ç and à".getBytes(),"utf-8"));</span><br>
<br> and load it like this, then the strings are retrieved ok.<br><br> <span style="font-family: courier new,monospace;"> RuleBase ruleBase = RuleBaseLoader.getInstance().loadFromReader(new InputStreamReader(DroolsTest.class.getResourceAsStream( "Rules.drl" )));</span><br>
<br>Yet the same modification does not work if the rule is defined in the BRMS and loaded by the rules agent.<br><br><br>I noticed that in the portuguese example shown in <a href="http://labs.jboss.com/drools/">http://labs.jboss.com/drools/</a> no portuguese special chars are used, is this a limitation of the rules engine or am I just using wrong?<br>
<br>Can you point me in the right direction?<br><br>best regards,<br><br>João Mota<br>