This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes NetBeans UTF8 Encoding Problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "NetBeans UTF8 Encoding Problem?" Watch "NetBeans UTF8 Encoding Problem?" New topic
Author

NetBeans UTF8 Encoding Problem?

mahmoud saleh
Greenhorn

Joined: Sep 06, 2008
Posts: 19
hi iam making an application that uses arabic words encoded in UTF8 like the following
String str1=new String( "مرحبا".getBytes() , "UTF8");
but when i try to run the code in NetBeans,The Data Is Displayed As ???
Although My Windows Language Is Arabic?
also in the project properities>sources>Encoding>UTF-8 ?
also in project properities>build>compiling>additional compiler options>-encoding UTF-8 ?
also i tried to edit the netbeans.conf file by adding the encoding
netbeans_default_options="................ -J-Dfile.encoding=UTF-8" ?
every thing is completely right but the program keeps displaying the words as ???
but when i try to run the same code in IDE Like JCreator The Data Is Displayed Correctly?
so any ideas how to fix this problem ?
iam using NetBeans 6.5M1
Windows XP
JDK 6u4
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41137
    
  45
String.getBytes returns a byte array in the platform default encoding, which most likely is not UTF-8. So if you then try to construct a String from it by telling the JVM that it is UTF-8, you've got a problem.

Have you tried using just: String str1 = "مرحبا";
[ September 12, 2008: Message edited by: Ulf Dittmer ]

Ping & DNS - my free Android networking tools app
mahmoud saleh
Greenhorn

Joined: Sep 06, 2008
Posts: 19
yes you are right
that's did it
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: NetBeans UTF8 Encoding Problem?
 
Similar Threads
arabic data from the database
Arabic encoding
UTF-8 encoding
Encoding in Java file
Reading unicode characters from a file