[ https://issues.apache.org/jira/browse/NETBEANS-6298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17475029#comment-17475029 ]
Thomas Schapitz commented on NETBEANS-6298: ------------------------------------------- Ahh sorry, my bad. I was just triggered by the mentioning of the exec plugin at Jan 4th, and the console further up. You might be looking at two different different issues here. Welcome to one of Javas oldest quirks: Please take a look at this: [https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Properties.html#load(java.io.InputStream). |https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Properties.html#load(java.io.InputStream)]. Since its introduction in Java 1.2, Java properties files are specified to be encoded as ISO-8859-1. That is, unless they are written in xml (introduced with Java 1.5), or get loaded using [https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Properties.html#load(java.io.Reader).|https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Properties.html#load(java.io.Reader)], introduced with Java 1.6 In the later case, the user might in fact construct the required Reader with *any* encoding, but not necessarily the one found in system property file.encoding. But this has no power over the method using InputStream. If the property file is loaded by foreign code you can't change, you've got no chance then to comply, and encode it ISO-8859-1. And in fact, most property files get loaded this way, using [https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Class.html#getResourceAsStream(java.lang.String]) If you need to embed characters not encodable in ISO-8859-1 you would need to use proper Unicode escaping. This is a really nasty situation, as the IDE might have allowed to select a different encoding for property files, but didn't elect to; instead opted for safety & compatibility reasons to insist on ISO-8859-1 for properties files. If you can live with that, just don't use something else than ISO-8859-1 in property files. A proper remedy here is really hard to come by. Basically, it would either involve changing Javas implementation of [Properties.html#load(java.io.InputStream)|https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Properties.html#load(java.io.InputStream)] to use file.encoding, which could potentially break thousands of systems running with file.encoding set to something else, so it is rather unlikely to happen, or Netbeans to specify a separate encoding policy for properties files. This is one of the very few examples were eclipse has the upper: it allows to specify the encoding in the properties of every file. Introducing this into Netbeans will require some conviction. > Match NetBeans console encoding to system/app console encoding > -------------------------------------------------------------- > > Key: NETBEANS-6298 > URL: https://issues.apache.org/jira/browse/NETBEANS-6298 > Project: NetBeans > Issue Type: Bug > Components: cnd - Editor > Affects Versions: 12.0, 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, NB13, 13 > Environment: Windows 10、JDK1.8.201、Maven3.6.0、Netbeans12.6、Project > encoding UTF-8 > Reporter: luke > Priority: Blocker > Attachments: Garbled.gif, Garbled.png, console-output-well.png, > full_output.png, screenshot-1.png, screenshot-2.png, screenshot-3.png > > > My Windows OS language is Simplified Chinese and the default OS encoding is > GBK. When I open a properties file or a text file, the editor shows the file > contents as garbled, if I add the parameter -J-Dfile.encoding=UTF-8, the > editor opens the file in UTF-8 encoding format and the file is not garbled, > but the console output is garbled. > !Garbled.gif|width=1055,height=536! > !Garbled.png|width=1542,height=843! -- This message was sent by Atlassian Jira (v8.20.1#820001) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists