[ 
https://issues.apache.org/jira/browse/NETBEANS-6115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vladimir Machat updated NETBEANS-6115:
--------------------------------------
    Description: 
Trying to get user input containing 'special characters' like ščřžýáíé doesn't 
work in Maven project:

 
{code:java}
Scanner sc = new Scanner(System.in, "UTF-8");
System.out.println("Enter text: ");
String text = sc.nextLine();
System.out.println("You have entered: " + text);
 
{code}
 

 

In Netbeans this code will fail printing what you entered if you enter 
something like 'český, řeka etc...' but works ok with any input not containing 
these characters

Same code works in an Ant project without any problems.

It also works on command line by copying and pasting the command from Netbeans 
output window (and replacing the double quotes with single quotes). 

Example:
{code:java}
cd /home/atrament/Nextcloud/Projects/java/InputTestMaven; 
JAVA_HOME=/opt/java/jdk-14.0.1+7-hotspot M2_HOME=/opt/maven /opt/maven/bin/mvn 
-Dexec.vmArgs= "-Dexec.args=${exec.vmArgs} -classpath %classpath 
${exec.mainClass} ${exec.appArgs}" -Dexec.appArgs= 
-Dexec.mainClass=net.atramentovo.inputtestmaven.Main 
-Dexec.executable=/opt/java/jdk-14.0.1+7-hotspot/bin/java -Dfile.encoding=UTF-8 
org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
Running NetBeans Compile On Save execution. Phase execution is skipped and 
output directories of dependency projects (with Compile on Save turned on) will 
be used instead of their jar artifacts.
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Scanning for projects...-------------------< net.atramentovo:InputTestMaven 
>-------------------
Building InputTestMaven 0.1
--------------------------------[ jar ]------------------------------------ 
exec-maven-plugin:3.0.0:exec (default-cli) @ InputTestMaven ---
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Enter text: 
Řeka šuměla skalnatým údolím
You have entered: Xeka aumla skalnat�m �dol�m
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time:  2.682 s
Finished at: 2021-10-10T19:55:24+01:00
------------------------------------------------------------------------
{code}
 

 

 

  was:
Trying to get user input containing 'special characters' like ščřžýáíé doesn't 
work in Maven project:

 
{code:java}
Scanner sc = new Scanner(System.in, "UTF-8");
System.out.println("Enter text: ");
String text = sc.nextLine();
System.out.println("You have entered: " + text);
 
{code}
 

 

In Netbeans this code will fail printing what you entered if you enter 
something like 'český, řeka etc...' but works ok with any input not containing 
these characters

Same code works in an Ant project without any problems.

It also works on command line by copying and pasting the command from Netbeans 
output window (and replacing the double quotes with single quotes). 

Example of output:
{code:java}
cd /home/atrament/Nextcloud/Projects/java/InputTestMaven; 
JAVA_HOME=/opt/java/jdk-14.0.1+7-hotspot M2_HOME=/opt/maven /opt/maven/bin/mvn 
-Dexec.vmArgs= "-Dexec.args=${exec.vmArgs} -classpath %classpath 
${exec.mainClass} ${exec.appArgs}" -Dexec.appArgs= 
-Dexec.mainClass=net.atramentovo.inputtestmaven.Main 
-Dexec.executable=/opt/java/jdk-14.0.1+7-hotspot/bin/java -Dfile.encoding=UTF-8 
org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
Running NetBeans Compile On Save execution. Phase execution is skipped and 
output directories of dependency projects (with Compile on Save turned on) will 
be used instead of their jar artifacts.
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Scanning for projects...-------------------< net.atramentovo:InputTestMaven 
>-------------------
Building InputTestMaven 0.1
--------------------------------[ jar ]------------------------------------ 
exec-maven-plugin:3.0.0:exec (default-cli) @ InputTestMaven ---
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Enter text: 
Řeka šuměla skalnatým údolím
You have entered: Xeka aumla skalnat�m �dol�m
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time:  2.682 s
Finished at: 2021-10-10T19:55:24+01:00
------------------------------------------------------------------------
{code}
 

 

 


> UTF-8 input is broken in Maven project
> --------------------------------------
>
>                 Key: NETBEANS-6115
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-6115
>             Project: NetBeans
>          Issue Type: Bug
>         Environment: Linux Manjaro
> Netbeans 12.5 (but the same problem is in earlier versions too)
> Maven 3.8.2
> Java - tried with 8,14,17 
>  
>            Reporter: Vladimir Machat
>            Priority: Major
>
> Trying to get user input containing 'special characters' like ščřžýáíé 
> doesn't work in Maven project:
>  
> {code:java}
> Scanner sc = new Scanner(System.in, "UTF-8");
> System.out.println("Enter text: ");
> String text = sc.nextLine();
> System.out.println("You have entered: " + text);
>  
> {code}
>  
>  
> In Netbeans this code will fail printing what you entered if you enter 
> something like 'český, řeka etc...' but works ok with any input not 
> containing these characters
> Same code works in an Ant project without any problems.
> It also works on command line by copying and pasting the command from 
> Netbeans output window (and replacing the double quotes with single quotes). 
> Example:
> {code:java}
> cd /home/atrament/Nextcloud/Projects/java/InputTestMaven; 
> JAVA_HOME=/opt/java/jdk-14.0.1+7-hotspot M2_HOME=/opt/maven 
> /opt/maven/bin/mvn -Dexec.vmArgs= "-Dexec.args=${exec.vmArgs} -classpath 
> %classpath ${exec.mainClass} ${exec.appArgs}" -Dexec.appArgs= 
> -Dexec.mainClass=net.atramentovo.inputtestmaven.Main 
> -Dexec.executable=/opt/java/jdk-14.0.1+7-hotspot/bin/java 
> -Dfile.encoding=UTF-8 org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
> Running NetBeans Compile On Save execution. Phase execution is skipped and 
> output directories of dependency projects (with Compile on Save turned on) 
> will be used instead of their jar artifacts.
> Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
> Scanning for projects...-------------------< net.atramentovo:InputTestMaven 
> >-------------------
> Building InputTestMaven 0.1
> --------------------------------[ jar ]------------------------------------ 
> exec-maven-plugin:3.0.0:exec (default-cli) @ InputTestMaven ---
> Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
> Enter text: 
> Řeka šuměla skalnatým údolím
> You have entered: Xeka aumla skalnat�m �dol�m
> ------------------------------------------------------------------------
> BUILD SUCCESS
> ------------------------------------------------------------------------
> Total time:  2.682 s
> Finished at: 2021-10-10T19:55:24+01:00
> ------------------------------------------------------------------------
> {code}
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to