[rules-users] Re: rule text internationalization - write rules (drl) in chinese

Irving Reid irving at cfrq.net
Tue May 13 14:01:24 EDT 2008


I’ve come across a couple of problems with character set handling and transcoding, that I haven’t had time to log Jira issues about yet. As a first pass, make sure you’re using the platform default character encoding in your rules files – most of the Drools code doesn’t specify what encoding to use, so it should pick up the default encoding for the OS it’s running on.

 

However, there’s one place in the BRMS where that’s not true, and it caused me several days of pain. As I said, the JIRA issue is coming soon…

 

 - irving -

 

From: rules-users-bounces at lists.jboss.org [mailto:rules-users-bounces at lists.jboss.org] On Behalf Of Edson Tirelli
Sent: Tuesday, May 13, 2008 1:18 PM
To: Rules Users List
Subject: Re: [rules-users] Re: rule text internationalization - write rules (drl) in chinese

 


  Dejia,

  This is probably a problem that requires fixing in the rules parser. Drools uses ANTLR to generate its parser.
  Maybe you can help doing some research about any specific care that must be taken when working with ANTLR and unicode characters?

  The grammar we currently use is here:

http://anonsvn.labs.jboss.com/labs/jbossrules/branches/4.0.x/drools-compiler/src/main/resources/org/drools/lang/DRL.g

   Thanks, 

   []s
   Edson

2008/5/12 Dejia Wang <dejia.wang at gmail.com>:

 

hi all, 

 

we tried to write rules in chinese like follows

 

rule "Reorder alert when item expires"
 salience 10
 when
    $item : ImsItemRecords ()    
 then 
    if ( ! (new Date()).before ($item.getExpireDate()))
    {
      SysAlert alert = new SysAlert("过期 - " + $item.getItemName(), "补充库存", "很高", "新到", new Date(),  null);
      SysRecommendation recommendation1 = new SysRecommendation (alert, "补充库存", "购买" + $item.getAmount() + $item.getUnit() + $item.getItemName(), "仓库管理人员", "立即");
      ...

      HashSet recommendations = new HashSet();
      recommendations.add(recommendation1);

      ...
      alert.setSysRecommendations(recommendations);    
      insert (alert);  
    }
end

The rule execution is fine, but the result is unexpected. some of above chinese characters (for example, "新到") are good; some of above chinese characters become ??? after rule evaluation. 

 

any tips how to fix this.

 

thanks- dejia



_______________________________________________
rules-users mailing list
rules-users at lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users




-- 
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080513/574f3ca2/attachment.html 


More information about the rules-users mailing list