[
https://issues.jboss.org/browse/JBRULES-2853?page=com.atlassian.jira.plug...
]
Geoffrey De Smet resolved JBRULES-2853.
---------------------------------------
Assignee: Geoffrey De Smet (was: Edson Tirelli)
Fix Version/s: 5.4.0.Final
(was: 5.4.0.CR1)
Resolution: Done
Fixed for 5.4.0 and on master (5.5)
It's not backported to 5.3 at this time, because DrlParser conflicts: in 5.3 it
doesn't receive the Resource as a parameter, but the InputStream directly. I'd
have to change those DrlParser's public methods and their usage in up to 140 files (or
find the set of commits that changed this and backport them). Either way, it's a big,
risky change.
If we want to backport it to 5.3 anyway, here's how to do it, after the DrlParser
methods have been changed:
{code}
droolsjbpm-knowledge:
git cherry-pick -x 37299dca97ffe05e7f0a6d7bc52501fc351f0b95
drools:
git cherry-pick -x 8dd9ab3d8f7ed9c18229e1ed890be0bd39ddb11f
git cherry-pick -x a23e680344abf399bfadd1cf25d6769c2a0335e1
git cherry-pick -x e8c4e89cfaf8e3cf91ba337e10cc2da760079c37
git cherry-pick -x 905711adeef24d8ac9cafab0131c100521f3c408
git cherry-pick -x 9403902912a8564332c89ed674ca85f886f146d9
{code}
ResourceFactory.newClassPathResource(drlPath) behaves differently on
different platforms (linux, windows): it parses the file with different encodings
------------------------------------------------------------------------------------------------------------------------------------------------------
Key: JBRULES-2853
URL:
https://issues.jboss.org/browse/JBRULES-2853
Project: Drools
Issue Type: Bug
Security Level: Public(Everyone can see)
Reporter: Geoffrey De Smet
Assignee: Geoffrey De Smet
Priority: Critical
Fix For: 5.4.0.Final
This really sucks for non English people :) English people write in pure ASCII, so they
don't suffer from this problem.
French, Dutch etc mix in Latin-1 chars. Russian, Chinese use something else.
The root problem: There are 2 ways to create an InputStream:
- with encoding = GOOD, use encoding "UTF-8" and there are no problems.
- without encoding: use the default platform encoding = BAD
-- Linux: UTF-8, Windows in Belgium: Latin-1, Windows in China: Chinese-1, Windows in
Sweden: Latin-2, ...
-- Java's InputStream should have just defaulted it on UTF-8
Proposition 1: Overloaded method which has an extra String encoding:
- ResourceFactory.newClassPathResource(drlPath, encoding)
- similar tactic as InputStream
Proposition 2: Keep it simple. We decide what a DRL file is.
Just like an XML file says to hell with the specified encoding, so can we.
Note: All XML files default to UTF-8 encoding, and you can overwrite it in a header in
the XML file itself (= self-describing): no need to mess around in the java code.
Same principle: All DRL files are default UTF-8 encoding. Optionally we can define an
encoding header later.
I strongly prefer proposition 2. The world has got enough encoding problems.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira