hello,
I prepare an application uses the result of the command prompt (Runtime.getRuntime (). exec (cmd)) for a command already entered, and displays it in a Textarea, but I notice that if I use a modal box the problem persists, my problem is that this application is in frensh,if any one can help me to display "é" and "è" lettres because they appear as a small cube (whatever in the text area or the modal box) if any one know how I can solve the problem because I'm a beginner in java and thank you for any help.

hello,
I prepare an application uses the result of the command prompt (Runtime.getRuntime (). exec (cmd)) for a command already entered, and displays it in a Textarea, but I notice that if I use a modal box the problem persists, my problem is that this application is in frensh,if any one can help me to display "é" and "è" lettres because they appear as a small cube (whatever in the text area or the modal box) if any one know how I can solve the problem because I'm a beginner in java and thank you for any help.

Hmm may these be of help:http://stackoverflow.com/questions/2914069/how-to-add-diffrent-characterset-support-for-jtextarea and this:http://www.rgagnon.com/javadetails/java-0456.html

First, you could check that the letters are being transferred correctly from your Runtime exec, and if so, how they have been encoded. Try printing the string with its UniCode numerical values, eg

String s = (the string you get from exec)
for (int i=0; i<s.length();i++)
 System.out.println(s.charAt(i) + " = " + (int)s.charAt(i) );

hello,
I downloaded jcharset.jar but my problem displaying letters like "é" and "è" persists
here's the actionPerformed method, if I click on Jboutton1:

private void jButton1ActionPerformed (java.awt.event.ActionEvent evt) {
/ / TODO add your handling code here:


if (evt.getSource () == jButton1)
{
if (jTextField1.getText (). compareToIgnoreCase ("")! = 0) {


start (jTextField1.getText ());
}

else
{
JOptionPane.showMessageDialog (this,
"You must type a valid IP address!"
"Runtime error"
JOptionPane.WARNING_MESSAGE);
}
}


}

then, this is the method that will use the command prompt after the click on the jbutton1, and will send the result to the textarea (jTextArea1):

public void start (String TextTape) {


try {

String cmd = "tracert" + TextTape;
jTextArea1.append ("start location");
Process p = Runtime.getRuntime (). Exec (cmd);
P.getInputStream InputStream in = ();
StringBuilder build = new StringBuilder ();
char c = (char) in.read ();
while (c! = (char) -1) {
build.append (c);
c = (char) in.read ();
}
String response = build.toString ();
jTextArea1.setText (response);
} catch (Exception e) {
jTextArea1.append (e.toString ());
}
}

It's your thread, so you can safely ignore my post and just display a load of code that doesn't even compile. Good luck.

@JamesCherill
thanks a lot for your help,I tested your code,but a still have the same problem and thanks again :)

What do yo mean "you tested my code?" That code was never going to fix anything. It was a diagnostic. You needed to run it and share the results.
Let me explain:
Internally Java uses 16 bit UniCode to hold chars, so accented chars are no problem. But you have input from an 8 bit cmd/file environment where there is no definitive implementation for accents. You are then displaying via fonts that may or may not implement UniCode chars outside the ASCII set.
So your problem could be when the chars are input OR when they are displayed. By printing the numeric values for your text in your program we can see whether the problem is in input or display. Once we know which it is we can progress towards fixing it.

hi,
my problem is how letters like 'é' and 'è' will be displayed in the texterea in all letters and that will not be replaced by other special caracters, my code works Correctly, I need some help intended to display this letters in output, if you can help me and thank you. :'(

this the result in the textarea when I tape "tracert www.google.fr"


D�termination de l'itin�raire vers www-cctld.l.google.com [74.125.230.248]

avec un maximum de 30 sauts�:

1 46 ms 99 ms 99 ms dsldevice.lan [192.168.1.254]

2 19 ms 19 ms 19 ms 41.226.21.8

3 19 ms 19 ms 18 ms 172.18.0.1

4 23 ms 18 ms 22 ms 192.168.0.2

5 20 ms 19 ms 20 ms 192.168.1.2

6 20 ms 20 ms 19 ms 192.168.2.1

7 19 ms 20 ms 19 ms 193.95.19.77

8 20 ms 19 ms 19 ms 193.95.96.153

9 19 ms 19 ms 19 ms 193.95.1.102

10 43 ms 87 ms 60 ms 72.14.196.233

11 55 ms 55 ms 69 ms 216.239.43.156

12 48 ms 48 ms 3640 ms 209.85.252.36

13 70 ms 75 ms 69 ms 216.239.43.68

14 58 ms 56 ms 56 ms 209.85.242.51

15 55 ms 54 ms 55 ms par08s10-in-f24.1e100.net [74.125.230.248]

Itin�raire d�termin�.

how can I delete those � caracters,can any one correct my code and thanks a lot

You are just repeating yourself. I tried to help diagnose this problem but you chose to ignore that. I am wasting no more time here.

Have you tried printing out the int values of those characters so we can see what they are?
If you want help, you need to print out their values and post it here using a technique as shown by James or this one shown below.

String s = (the string you get from exec)
for (int i=0; i<s.length();i++)
   System.out.println(s.charAt(i) + " = " + Integer.toHexString(s.charAt(i)) );

hi,
I did that and yhis is the result:

t = 74
r = 72
a = 61
c = 63
e = 65
r = 72
t = 74
= 20
1 = 31
9 = 39
2 = 32
. = 2e
1 = 31
6 = 36
8 = 38
. = 2e
5 = 35
6 = 36
. = 2e
1 = 31

and this when I tape tracert www.google.fr:
t = 74
r = 72
a = 61
c = 63
e = 65
r = 72
t = 74
= 20
w = 77
w = 77
w = 77
. = 2e
g = 67
o = 6f
o = 6f
g = 67
l = 6c
e = 65
. = 2e
f = 66
r = 72

Where are the characters you are having problems with?
I don't see any problems in what you posted.

thanks a lot for all your help my problem was resolved,I used a charset Europeen Encoder :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.