This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 172265 - strange encoding of environment variables
Summary: strange encoding of environment variables
Status: RESOLVED DUPLICATE of bug 188864
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker (vote)
Assignee: David Simonek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-15 09:55 UTC by dusanmsk
Modified: 2010-08-05 13:40 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
logs (36.08 KB, text/plain)
2009-09-15 12:50 UTC, dusanmsk
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dusanmsk 2009-09-15 09:55:35 UTC
Run following code:

 public static void main(String[] args) {
        System.out.println(System.getenv("APPDATA"));
    }

on non-us win xp ( tested on CZ ) in Netbeans and manually from terminal ( java -jar ... )

You will get strange result when running in Netbeans

C:\Documents and Settings\msk\Data aplikacˇ

instead of

C:\Documents and Settings\msk\Data aplikací.

The same situation occure when you write that string into file.
Comment 1 Milos Kleint 2009-09-15 10:37:42 UTC
what is the encoding of the project? what is the default encoding on the machine?

I suppose it's an issue between the maven output processing and output console printing..the actual data in the app
shall not be influenced by this or does your last sentence suggest that the application itself is getting wrong data?

can you please attach your IDE log file?
Comment 2 dusanmsk 2009-09-15 12:48:47 UTC
Encoding of project sources are windows-1250 ( Project/properties/sources/encoding). Tested with utf8 too.
I think this is not only console encoding problem, try following code on cz winxp:

        File dataDir = new File (System.getenv("APPDATA"));
        System.out.println(dataDir);
        System.out.println(dataDir.exists());

Second print will print "false" in netbeans and "true" when running from console.

Could you tell me how to get default system encoding on winxp? I can't see it in environment, in windows control 
panels it is set as "Cestina" and "Ceska republika". I am not windows power user :)
Comment 3 dusanmsk 2009-09-15 12:50:55 UTC
Created attachment 87686 [details]
logs
Comment 4 Milos Kleint 2009-09-17 11:36:09 UTC
according to your log file the encoding/locale is:
 System Locale; Encoding = cs_CZ (nb); Cp1250

the fact that the file does exist in the command line execution and doesn't exist in netbeans sounds serious. Not sure
how it is related to NetBeans then though. There are multiple points of stream reading/writing, some on maven and it's
plugins, some on netbeans output processing. But if the file doesn't exists, it's more likely something with the
environment the app runs at, since System.getenv("APPDATA") seems to retrieve different data each time.
Can you try running the maven build on the command line, rather than using the plain java -jar there?
Comment 5 dusanmsk 2009-09-17 14:15:39 UTC
c:\encoding1>mvn install exec:exec -Dexec.executable=java -Dexec.args="-classpath %classpath test.App"

[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'exec'.
[INFO] ------------------------------------------------------------------------
[INFO] Building encoding1
[INFO]    task-segment: [install, exec:exec]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1250 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (Cp1250 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory c:\encoding1\src\test\resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] No tests to run.
[INFO] [jar:jar {execution: default-jar}]
[INFO] [install:install {execution: default-install}]
[INFO] Installing c:\encoding1\target\encoding1-1.0-SNAPSHOT.jar to C:\Documents and
Settings\msk\.m2\repository\cz\test\encoding1\1.0-SNAPSHOT\encoding1-1.0-SNAPSHOT.jar
[INFO] [exec:exec {execution: default-cli}]
[INFO] C:\Documents and Settings\msk\Data aplikacˇ
[INFO] false

^^^^^

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Thu Sep 17 15:16:50 CEST 2009
[INFO] Final Memory: 10M/17M
[INFO] ------------------------------------------------------------------------
Comment 6 Milos Kleint 2009-09-17 14:40:40 UTC
that makes it a maven problem primarily i'm afraid. Can you try again with the -X (debug output) switch? and attach the
output to the issue?

marking TM as "next", as the resolution depends on external entiry and will not likely be included when 6.8 ships
(unless a bug directly in exec-maven-plugin, then we might make it)

what version of maven are you using? does the issue occur with multiple versions?
Comment 7 dusanmsk 2009-09-17 15:26:03 UTC
Apache Maven 2.2.0 (r788681; 2009-06-26 15:04:01+0200)
Java version: 1.6.0_15
Java home: c:\Program Files\Java\jdk1.6.0_15\jre
Default locale: cs_CZ, platform encoding: Cp1250
OS name: "windows xp" version: "5.1" arch: "x86" Family: "windows"

I'll try another version asap
Comment 8 dusanmsk 2009-09-17 15:36:29 UTC
2.2.1, the same problem. Could you report a bug to exec plugin, please? ( I haven't account there ).

Thank you.
Comment 9 Milos Kleint 2009-09-23 06:45:12 UTC
I actually meant something older like 2.0.10, 
it would be definitely better if you file it as you can provide details into the problem and can test fixes (unlike me -
I have just english Mandriva Linux on my box)
Comment 10 dusanmsk 2010-02-18 07:21:16 UTC
FYI: http://jira.codehaus.org/browse/MEXEC-75.
Comment 11 Antonin Nebuzelsky 2010-07-23 13:28:53 UTC
MEXEC-75 is marked as fixed in exec-maven-plugin 1.2.

Can you mark this issue as verified if it fixes the problem for you in latest netbeans dev build? See issue 188864. Thanks.
Comment 12 Jesse Glick 2010-08-05 13:40:04 UTC

*** This bug has been marked as a duplicate of bug 188864 ***