Ognjen Blagojevic created OPENJPA-2552:
------------------------------------------

             Summary: When reading orm.xml encoding defined in prolog should be 
taken into account
                 Key: OPENJPA-2552
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2552
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 2.3.0
            Reporter: Ognjen Blagojevic


File orm.xml may contain JPQL or SQL queries with string literals with 
non-ASCII characters, e.g.

  <named-native-query name="test">
    <query>
        select 'ћирилица'
     </query>
  </named-native-query>  

Note the string literal with cyrillic letters. 

If JVM variable file.encoding is set to something different (e.g. 
-Dfile.encoding=ISO-8859-1) from encoding of the file, specified in prolog of 
orm.xml (e.g. UTF-8), OpenJPA will respect file.encoding setting, which will 
demage string literals.

According to XML specification, OpenJPA should respect encoding as specified in 
prolog.

The problematic method seems to be: 
org.apache.openjpa.lib.meta.XMLMetaDataParser. parse(MetaDataIterator itr, 
boolean stopFirst), which opens InputStreamReader with default encoding from 
file.encoding variable.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to