You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/06/21 14:01:55 UTC

[GitHub] [netbeans] duoduobingbing opened a new issue, #4261: Netbeans Output window uses wrong encoding

duoduobingbing opened a new issue, #4261:
URL: https://github.com/apache/netbeans/issues/4261

   ### Apache NetBeans version
   
   Apache NetBeans 14
   
   ### What happened
   
   * Have `-J-Dfile.encoding=utf-8` inside the `netbeans_default_options` under `{INSTALLDIR}/netbeans/etc/netbeans.conf`
   * Create a new Maven Project
   * Have it print something like
     ```
     System.out.println("%s, %s".formatted(System.getProperty("file.encoding"), Charset.defaultCharset()));
     System.out.println("✨✨✨");
     ```
   * Add `-Dfile.encoding=utf-8` to `exec.vmArgs` inside the project's `nbactions.xml` for the *Run* action 
   * Run
   * Instead of the expected '✨✨✨' or Tofu Boxes it spits out:
     ```
     utf-8, UTF-8
     ✨✨✨
     ```
   
   ### How to reproduce
   
   Probably is a Windows only problem, as the Output window seems to just use the Windows default encoding, which in my case is WIN1252 and ignore the encoding that has been set JVM-wide.
   
   Interpreting ✨✨✨ as WIN1252 instead of UTF-8 yields the mangled output '✨✨✨' which I got.
   
   Having `JAVA_TOOL_OPTIONS=-Dfile.encoding=utf-8` and `MAVEN_OPTS=-Dfile.encoding=utf-8` set as system variables under `HKCU\Environment` also does not fix the problem.
   
   
   ### Did this work correctly in an earlier version?
   
   Apache NetBeans 13
   
   ### Operating System
   
   Windows 10
   
   ### JDK
   
   17.0.3 (Eclipse Adoptium Temurin)
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip
   
   ### Anything else
   
   This does work in Netbeans 13 and before, so this bug was introduced in Netbeans 14.
   
   ### Are you willing to submit a pull request?
   
   No
   
   ### Code of Conduct
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] duoduobingbing commented on issue #4261: Netbeans Output window uses wrong encoding

Posted by GitBox <gi...@apache.org>.
duoduobingbing commented on issue #4261:
URL: https://github.com/apache/netbeans/issues/4261#issuecomment-1161917579

   I've investigated this further and found the culprit. It's because of [PR#3863](https://github.com/apache/netbeans/pull/3836). 
   
   Printing out
   ```
   System.out.println(Charset.defaultCharset());
   System.out.println(System.getProperty("file.encoding"));
   System.out.println(System.getProperty("native.encoding"));
   System.out.println(System.getProperty("sun.jnu.encoding"));
   ```
   got the answer.
   
   This got me the following results for JDK18 and JDK17:
   ```
   UTF-8
   UTF-8
   Cp1252
   Cp1252
   ```
   
   Setting `native.encoding` via `-Dnative.encoding=utf-8` under Windows does not change the value that is obtainable via `System.getProperty("native.encoding")`. It always reflects the output of `sun.jnu.encoding` which is also not changeable via java command line under Windows.
   
   PR#3863 incorrectly assumes that `native.encoding` is `null` when not set explicitly, which its not true under Windows. Neither for JDK17 nor JDK18. So under Windows Netbeans just uses `sun.jnu.encoding` regardless of configuration for the output window which is for my machine always Windows1252.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] neilcsmith-net commented on issue #4261: Netbeans Output window uses wrong encoding

Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on issue #4261:
URL: https://github.com/apache/netbeans/issues/4261#issuecomment-1185669743

   Is this actually a duplicate of #3824 , or at least related?  Good link posted there to https://bugs.openjdk.org/browse/JDK-8283620 and through that to https://git.openjdk.java.net/jdk/pull/8270 which introduces new system properties `stdout.encoding` and `stderr.encoding`.  These are official variants of `sun.stdout.encoding` and `sun.stderr.encoding`.
   
   So we should probably use same principle of `stdout.encoding` overrides `sun.stdout.encoding` overrides `native.encoding`, rather than introducing something else?
   
   Also a question of whether the project properties (in `exec.vmArgs`) should override the IDE settings?
   
   cc @mbien @matthiasblaesing thoughts?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] neilcsmith-net closed issue #4261: Netbeans Output window uses wrong encoding

Posted by GitBox <gi...@apache.org>.
neilcsmith-net closed issue #4261: Netbeans Output window uses wrong encoding
URL: https://github.com/apache/netbeans/issues/4261


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] marccollin commented on issue #4261: Netbeans Output window uses wrong encoding

Posted by "marccollin (via GitHub)" <gi...@apache.org>.
marccollin commented on issue #4261:
URL: https://github.com/apache/netbeans/issues/4261#issuecomment-1508555947

   this issue is still there with netbeans 17 and jdk 17


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] mossaab0 commented on issue #4261: Netbeans Output window uses wrong encoding

Posted by GitBox <gi...@apache.org>.
mossaab0 commented on issue #4261:
URL: https://github.com/apache/netbeans/issues/4261#issuecomment-1264533092

   > @mossaab0 If you run Netbeans 15 with JDK19+, you will need to add `-Dstdout.encoding=utf-8`; with JDK18 you will need to add `-Dsun.stdout.encoding=utf-8` as `native.encoding` is not settable.
   
   That helped. Thanks, @duoduobingbing!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] duoduobingbing commented on issue #4261: Netbeans Output window uses wrong encoding

Posted by GitBox <gi...@apache.org>.
duoduobingbing commented on issue #4261:
URL: https://github.com/apache/netbeans/issues/4261#issuecomment-1161882019

   Update:
   
   Switching to JDK18 does not fix the problem. 
   Running Netbeans under JDK18 and the Project under JDK18 yields:
   ```
   utf-8, UTF-8
   ???
   ```
   
   Setting `native.encoding=utf-8`, `file.encoding=utf-8` to `MAVEN_OPTS`, `JAVA_TOOL_OPTIONS`, `nbactions.xml` and/or `nbactions.xml` does nothing to change this result.
   
   Running Netbeans under JDK18 and the Project under JDK17 yields:
   ```
   utf-8, UTF-8
   ✨✨✨
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] duoduobingbing commented on issue #4261: Netbeans Output window uses wrong encoding

Posted by GitBox <gi...@apache.org>.
duoduobingbing commented on issue #4261:
URL: https://github.com/apache/netbeans/issues/4261#issuecomment-1164633811

   @matthiasblaesing Would it be possible to just revert #3836 ? 
   If it is desired behavior to keep the platform native encoding and not revert #3836, another option would be to have a property like `-J-Dnetbeans.encoding.preferNativeEncoding=false` that could be set, so that `Charset.defaultCharset()` is used instead of the `native.encoding`-Property, so that Windows users at least regain the option to switch their Netbeans Output encoding to UTF-8


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] mossaab0 commented on issue #4261: Netbeans Output window uses wrong encoding

Posted by GitBox <gi...@apache.org>.
mossaab0 commented on issue #4261:
URL: https://github.com/apache/netbeans/issues/4261#issuecomment-1264478418

   I'm facing this issue (on Windows 11) in NB14 and NB15. I've tried JDK17 and JDK19 with no success.
   NB13 works just fine.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] duoduobingbing commented on issue #4261: Netbeans Output window uses wrong encoding

Posted by GitBox <gi...@apache.org>.
duoduobingbing commented on issue #4261:
URL: https://github.com/apache/netbeans/issues/4261#issuecomment-1264500703

   @mossaab0 If you run Netbeans 15 with JDK19+, you will need to add `-Dstdout.encoding=utf-8`; with JDK18 you will need to add `-Dsun.stdout.encoding=utf-8` as `native.encoding` is not settable.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] Netbeans Output window uses wrong encoding [netbeans]

Posted by "olivalpaulino (via GitHub)" <gi...@apache.org>.
olivalpaulino commented on issue #4261:
URL: https://github.com/apache/netbeans/issues/4261#issuecomment-2078201068

   Solved! Watch this video: https://youtu.be/kXvWm64RBU0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists