]
Mario Fusco updated DROOLS-4662:
--------------------------------
Sprint: 2019 Week 50-52 (from Dec 9)
Resources added through KieHelper get interpreted using the default
character set
---------------------------------------------------------------------------------
Key: DROOLS-4662
URL:
https://issues.redhat.com/browse/DROOLS-4662
Project: Drools
Issue Type: Bug
Affects Versions: 7.10.0.Final, 7.20.0.Final, 7.28.0.Final
Environment: Windows. Can be reproduced on other OSes using
"-Dfile.encoding=latin1".
Reporter: Max Zerzouri
Assignee: Mario Fusco
Priority: Major
Attachments: Test.java
When a resource is added using {{KieHelper.addResource}}, any specified encoding is
ignored when it is added to the {{MemoryFileSystem}} by
{{KieFileSystemImpl.write(Resource)}} (effectively assuming the {{InputStream}} is already
encoded in UTF-8).
Additionally, when the resource is read again by {{AbstractKieModule.getResource}}, it
constructs a {{Resource}} object with no encoding specified, whereas it should probably
specify an encoding of UTF-8, since it seems that sources are considered to be UTF-8
already at least in the case of the {{MemoryKieModule}}.
I've attached a fairly minimal test case where the rules bytes are passed in UTF-8
with the encoding explicitly specified. This currently produces an error when the default
file encoding is not UTF-8 (eg, by passing {{-Dfile.encoding=latin1}} as a JVM argument,
or by using the default arguments on Windows).