-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encoding issue with jdt.ls javadoc #524
Comments
This is an m2e bug. junit-3.8.1-sources.jar uses the ISO-8859-1 encoding and m2e doesn't allow changing source attachment encoding. @fbricon Would you like me to try to fix this issue in m2e? |
@snjeza before you try to fix m2e, do you have a general idea on how to do it? |
We could add a maven property as the following:
|
Mmm that would not work OOTB. And you probably need to handle javadoc and sources differently. An alternative might be to, before attaching the file, inspect the 1st (java) file in there and try to detect the encoding via ICU4J (see https://stackoverflow.com/questions/499010/java-how-to-determine-the-correct-charset-encoding-of-a-stream/4013565#4013565), for instance. @ifedorenko WDYT? |
Agree with Fred, the encoding has to come from somewhere and encoding detection seems like a reasonable thing to do. Although I guess it won't be 100% reliable, for things like mixed-encoding sources, not using all sources during autodetection, etc. Other options you may want to try
good luck ;-) |
@snjeza If going with ICU4J, make sure you're not depending on the icu4j bundle, but the packages, since jdt.ls only embeds the base icu4j jar |
@fbricon @ifedorenko |
Autodetection will never be 100% reliable, especially if it does not consider all source files. |
A solution for a gradle project is:
|
@snjeza I'm curious, does icu4j detect anything other than utf-8 if you scan the entire junit-3.8.1-sources.jar? |
icu4j detects encoding correctly when scanning junit-3.8.1-sources.jar, icu4j-60.2-sources.jar, commons-io-2.6-sources.jar ...
@fbricon we should add the icu4j dependency to the org.eclipse.m2e.jdt bundle. jdt.ls would have to include the icu4j bundle. |
|
Test for eclipse-jdtls/eclipse.jdt.ls#524 Signed-off-by: Snjezana Peco <[email protected]>
Since encoding detection gives worse results than the default UTF-8 encoding, |
It is turned out that the original source isn't utf-8 encoded.
I am not sure if it is possible to handle that.
vs code:
![35158006-693ee2f0-fd3e-11e7-9fb5-7512cb1fc8a1](https://user-images.githubusercontent.com/1640675/35158273-46e8918c-fd3f-11e7-9a4d-272ff66d35bf.png)
Che:
![33475895-4a2825fa-d680-11e7-887b-492aff5c38f0](https://user-images.githubusercontent.com/1640675/35158250-37707ddc-fd3f-11e7-9756-aba3df27ab10.png)
eclipse-che/che#7674
The text was updated successfully, but these errors were encountered: