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/11/29 02:00:21 UTC

[GitHub] [netbeans-native-launchers] eirikbakke opened a new pull request, #7: Make the Windows launcher work with Unicode paths

eirikbakke opened a new pull request, #7:
URL: https://github.com/apache/netbeans-native-launchers/pull/7

   On Windows, the `C:\Users\<username>` path will often contain the user's real human name. When this path contains characters outside the current "ANSI code page" (an old DOS concept that predates Unicode), lots of different things break, and NetBeans will fail to work. See https://github.com/apache/netbeans/issues/4314.
   
   The underlying problem is that both OpenJDK and the NetBeans launcher, like most old Windows software, tend to use the "ANSI" versions of Win32 APIs rather than the "Wide Char" versions (e.g. GetCurrentDirectoryA instead of GetCurrentDirectoryW). About 3 years ago, Microsoft started recommending an easy solution: Rather than replacing "char *" with "wchar_t *" everywhere, we can now set UTF-8 as the default "code page" for all ANSI Win32 API calls, at the EXE file process level. We do this here for the NetBeans Windows launcher. See https://learn.microsoft.com/en-us/windows/apps/design/globalizing/use-utf8-code-page
   
   Since the NetBeans Windows launcher uses JNA to start Java in-process, the JVM inherits the same default code page setting, without the user having to change regional settings in the Control Panel. Everything then works consistently; passing of system properties into the JVM, loading of libraries from Unicode paths from the system classloader or JNA, and so on. This assumes that the JVM takes its Win32 code page setting from the "user" locale (the GetACP() Win32 function) rather than the "system" locale. This been explicitly the case since https://bugs.openjdk.org/browse/JDK-8272352, in Java 19 and recent backports to Java 11.0.17 and Java 17.0.5.
   
   We also set the UTF-8 code page for the windows console, so that Unicode characters display correctly there.
   
   On the aforementioned recent Java versions, NetBeans should now run fine when there are Unicode characters in the NetBeans installation path, the JDK path, the user/cache directory paths, or in the java.io.tmpdir path (the latter sometimes being a problem for JNA, which is used by FlatLAF). This was tested on Java 17.0.5 with Cyrillic and Norwegian characters in the OS home directory path and all of the paths above, with different combinations of Cyrillic vs. US English code pages set at the user vs. system level ("Formats/Format" vs. "Administrative/Change System Locale" in the "Region" control panel dialog). Both the NetBeans IDE launcher and a NetBeans Platform application launcher were tested.


-- 
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-native-launchers] eirikbakke commented on pull request #7: Make the Windows launcher work with Unicode paths

Posted by GitBox <gi...@apache.org>.
eirikbakke commented on PR #7:
URL: https://github.com/apache/netbeans-native-launchers/pull/7#issuecomment-1331011212

   Compilation is easy, actually, I just did "mvn clean install". Kudos to whoever set this up!


-- 
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-native-launchers] ebarboni commented on pull request #7: Make the Windows launcher work with Unicode paths

Posted by GitBox <gi...@apache.org>.
ebarboni commented on PR #7:
URL: https://github.com/apache/netbeans-native-launchers/pull/7#issuecomment-1330354372

   @eirikbakke @neilcsmith-net I will cancel the vote. There is no need to release launcher as this PR contains a nice fixe.
   
   @eirikbakke I'm not very fluent in the "native area". I wonder if we should/have to add more mingw parameter to easy your compilation.


-- 
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-native-launchers] ebarboni commented on pull request #7: Make the Windows launcher work with Unicode paths

Posted by GitBox <gi...@apache.org>.
ebarboni commented on PR #7:
URL: https://github.com/apache/netbeans-native-launchers/pull/7#issuecomment-1334996869

   Merging. Would be nice to discuss the version scheme on mailing list also.


-- 
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-native-launchers] ebarboni merged pull request #7: Make the Windows launcher work with Unicode paths

Posted by GitBox <gi...@apache.org>.
ebarboni merged PR #7:
URL: https://github.com/apache/netbeans-native-launchers/pull/7


-- 
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