Question

I have a Drools decision table in Excel(97/2000 format), and some of the strings used in rules have non-ascii characters like umlauts (Ä). When I build rules package with Camel-Drools integration module in Ubuntu 12.04LTS from this decision table, I get wrong characters in rules source.

For instance,

in spreadsheet -> Ääripää tässä tapauksessa,

in built drl file -> ��rip�� t�ss� tapauksessa

If I use exact same excel files in Windows/Ubuntu/Mac (Eclipse or IDEA makes no difference) development machines or even in Vagrant/VirtualBox/Ubuntu environment, there is no character encoding problems with drools rules.

Code is packaged into Spring-boot Jar-file, which contains Jetty server where application is deplyed. This same JAr file has been used to test in every different environment, but only one failing is the cloud-based testing environment.

Testing Environment is built up with Kitchen & Chef cookbooks and it is a cloud environment, haven't got the foggiest what is the difference between cloud environment and dev envs.

Have tried formatting excel files to UTF-8 encoding, but it seems impossible. And Camel-Drools integration module should have this fixed in their next release (6.0.0 https://issues.jboss.org/browse/JBRULES-2936) but that is still in beta and not usable yet. Nor have I got their timetable for stable release.

Anyone got a clue how to resolve this?

Was it helpful?

Solution 2

Reason found!

The cloud environment we use was configured with chef, and somehow the cookbook set character encoding to non-UTF whenever it rebooted cloud instance.

Hence the file was not recognized as UTF, as environment was telling java to use something else.

Thanks for comments and help all!

OTHER TIPS

Use the overloaded methods to specify the encoding when telling drools about the XLS:

public interface KieResources extends Service {

Resource newUrlResource(URL url);

Resource newUrlResource(URL url,
                        String encoding);

Resource newUrlResource(String path);

Resource newUrlResource(String path,
                        String encoding);

Resource newFileSystemResource(File file);

Resource newFileSystemResource(File file,
                               String encoding);

...

}

If you don't do that, it will use the default encoding of the Java platform which uses the default of the operation system (UTF-8 on linux, windows-1252 on a French Windows machine, ...)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top