[ http://issues.apache.org/jira/browse/IBATIS-349?page=comments#action_12454071 ] Jeff Butler commented on IBATIS-349: ------------------------------------
This is a complex issue. The real problem is that iBATIS ignores the encoding issue altogether in parsing - because we only accept a character reader. I had a quick look at Xerces source to see how they autodetect the encoding and their method is quite different than what you propose. Your method still uses the system default encoding to open the file, a potential source of errors. And it ignores the fact that the real encoding of the file may be different than what's declared in the processing instruction. Xerces figures out the encoding by looking at the first 4 bytes of the file. This is a complex algorithm that we don't want to replicate in iBATIS. I think the best way to resolve this is to allow iBATIS to accept a byte stream for parsing - then we could leverage the parser's built in support for dealing with different encodings. I'll have a look at doing that. In the meantime, please try manually setting the encoding to UTF-8 using the fix for IBATIS-340. I'd like to know if this addresses your immediate issue. > NodeletParser ignore XML encoding. > ---------------------------------- > > Key: IBATIS-349 > URL: http://issues.apache.org/jira/browse/IBATIS-349 > Project: iBatis for Java > Issue Type: Bug > Components: SQL Maps > Affects Versions: 2.2.0 > Environment: Windows XP(Japanese) > jdk 1.5.0_06 > Reporter: Daigo Kobayashi > Attachments: Resources.java, Resources.patch, Resources.patch > > > NodeletParser ignore XML encoding. Because NodeletParser use Resources, and > in some case Resources use ClassLoader#getResourceAsStream with OS default > encoding not XML's. > In some environment, for example OS use Shift_JIS and XML use UTF-8, iBatis > doesn't work correctly because of broken character. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira