Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] help! problem about encoding

Zhang,
 
What is the default character set for files created in your Eclipse?
 
Set it to UTF-8 or UTF-16, and then specify the ajc compiler to let it know what the source file encoding is.
 
ajc -encoding UTF-8  or
ajc -encoding UTF-16
You can specify the encoding option through AJDT.
 
This is similar to the behavior of javac.
 
You may already know this, but System.out.println output may work fine in the console output of Eclipse, but may not work if your command console (cmd windows) does not support unicode or multi-byte character.
 
So, ususally I write the output to a file using java's output stream with explicit specification of the encoding.
 
Monal
 


 
On 1/8/07, Heping Zhang <phoenix.zhp@xxxxxxxxx> wrote:


Mr. Webster,

Thanks for your reply. I use aspectj-1.5.3 and build the project in elipse 3.2.0. I build a new aspectj project, then add a test.java class to the src folder, which include the "main" method and println some Chinese character. But the output seems encoded incorrectly. And just as you presume, after I converted the project to a java project using aspectj tools in eclipse, the output became correct. In the aspectj project, I have tried " System.out.println(new String(s1.getBytes("gbk"), "utf-8"));", "System.out.println("unicode: " + new String("你好".getBytes("unicode")));" and and so forth. But they did not work as I except. Tht result still incorrect. I also have tried set the "non-standard compiler options" in aspectj compiler panel to "-encoding GBK" but it did not work, too. I worked on this problem for nearly two days and now I do not what I can do on earth. Can you help me?

Thank you very much!

Heping Zhang



2007/1/8, Matthew Webster <matthew_webster@xxxxxxxxxx>:

How are you building your application? Which version of AspectJ are you using? I presume you get the expected output when you application is compiled with javac (or equivalent)?

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/



"Heping Zhang" <phoenix.zhp@xxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

06/01/2007 13:11

Please respond to
aspectj-users@xxxxxxxxxxx

To
aspectj-users@xxxxxxxxxxx
cc
Subject
[aspectj-users] help! problem about encoding






hi,
In aspectj project when I use System.out.println("something"); and that "something" is not English words, the output is not encoded correctly. For example, I want print "你好你好" but get "浣�濂戒��濂�".  Can someone help me?
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top