| Summary: | IdeJavaSourceOutputStream always uses default charset | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Christian Stein <sormuras> |
| Component: | APT | Assignee: | Jay Arthanareeswaran <jarthana> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | eclipse, jarthana, sormuras |
| Version: | 4.4.2 | ||
| Target Milestone: | 4.6 M7 | ||
| Hardware: | PC | ||
| OS: | Windows 10 | ||
| See Also: |
https://git.eclipse.org/r/70723 https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=95a8299e9a4dec93fbd5f1afcde73dc1781505f6 |
||
| Whiteboard: | |||
|
Description
Christian Stein
Link to source: https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/tree/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/filer/IdeJavaSourceOutputStream.java#n68 Workaround: add "-Dfile.encoding=UTF-8" to eclipse.ini solved the problem here. It'd be nice to actually make use of the encoding info. I think a fix for this would be worth considering. There is no encoding info left at that level, iirc. The final write process should not re-encode the bytes it got from the processor. They are already encoded by an OutputStreamWriter. As I can't see a quick way to write the collected bytes "as is", maybe using the default charset from IContainer might be a solution: http://git.eclipse.org/c/platform/eclipse.platform.resources.git/tree/bundles/org.eclipse.core.resources/src/org/eclipse/core/resources/IContainer.java#n246 It could be retrieved via: "_env.getAptProject()..." right? (In reply to Christian Stein from comment #4) > It could be retrieved via: "_env.getAptProject()..." right? That would work. Only question is whether it is the AptProject or getJavaProject(). New Gerrit change created: https://git.eclipse.org/r/70723 Gerrit change https://git.eclipse.org/r/70723 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=95a8299e9a4dec93fbd5f1afcde73dc1781505f6 Writing a consistent testcase proved to be extremely difficult for two reasons: Setting the file.encoding in the middle of testcase execution doesn't have any impact. And two, all system I/O operations that a testcase would depend on in writing a encoding specific String would now be affected and has to be encoded accordingly. I have verified that this works for a simple case in the IDE. Thanks Jay for fixing this. Having this work-around should solve most of the charset problems - but still does not honor the actual character encoding used via Annotation Processing API. See initial issue description. (In reply to Christian Stein from comment #9) > Thanks Jay for fixing this. Having this work-around should solve most of the > charset problems - but still does not honor the actual character encoding > used via Annotation Processing API. See initial issue description. Yes, I agree. While trying to write a testcase I found that there are few other area as well that have this problem. I will try to summarize this in a separate bug. Verified for Neon M7 using I20160426-1615 build |