System.out console output CP1252/CP850

I've been trying to write something to receive XML as 'messages' through a socket connection and, in order to see better what's being parsed, I've been writing the elements and data to System.out so I can see the values in the console window (this is Windows XP).
The problem I get is that when the client passes German characters such as '�' (o-umlaut), they don't get displayed correctly on the console window - the character that actually gets displayed is '�' (division sign?) - even though the correct value DOES (as far as I can tell) find its way into my Java String object.
I've investigated this a bit and I find that if I 'force' the output to use encoding 'Cp850' (OEM - Multilingual Latin I) then it works correctly (I do this by creating an OutputStreamWriter object with that encoding and based on System.out and then I create a BufferedWriter based on that OutputStreamWriter).
If, however, I explicitly use Cp1252 (ANSI - Latin I) then I get the original problem. I don't understand this because as far as I can tell, Cp1252 included the '�' character as code 246, which is the one I'm passing to it.
It also may (or may not) be significant that my file.encoding property is set to 'Cp1252' but when I override this using the java -D command option, I get the correct result.
So, in essense, my question is: why does Cp850 work but Cp1252 not work?
Thanks in advance for any help
Regards
John

I could do, but that's not really a problem - I've already got the 'work around' I need using Cp850. I just want to understand WHY it does what it does, because it seems to me that Cp1252 should work as well.

Similar Messages

  • Need to hide System.out.println output in console

    class Hide{
    public void test(){
    System.out.println("hai");
    public static void main(String[] args){
    Hide obj=new Hide();
    obj.test();
    Output is : hai
    But I don't want to display hai. How i can hide this
    kindly help me on this........

    class Hide {
         public void test() {
              System.out.println("hai");
         public static void main(String[] args) {
              System.out.println("before");
              java.io.PrintStream old_out = System.out;
              try {
                   java.io.PrintStream pw = new java.io.PrintStream("test.txt");
                   System.setOut(pw);
              } catch (java.io.IOException e) {
                   e.printStackTrace();
              Hide obj=new Hide();
              obj.test();
              System.setOut(old_out);
              System.out.println("after");
    }

  • System.out console in GUI

    hi i'm constructing a GUI for one of my programs using the swing librarys however i cant figure out how to display the system.out's. I really have no idea how to do it or i would post how im trying to or usual if anyone knows a better way to print strings (an undetermined number of strings this is) to a GUI please let me know

    Hi,
    Why are you using System.out combined with Swing? Just print text to some text component instead (e.g. JTextArea, see the javadoc for that class for more info)
    Kaj

  • Not getting System.out.println output in Web Start Log File

    I am new to this but I'm running through the examples in Mauro Marinilli's "Java™ Deployment with JNLP™ and WebStart™" and the install-win and install-win2 examples are not writing properly to a user-specified log file on my desktop (chosen location). I have several versions of j2re/jre installed on my client computer and have started several of the javaws.exe files on my computer to specify that I wish to Show Java Console and Log Output but
    1) no Java console pops up when I subsequently run the JNLP from my web server
    AND
    2) no log file is written
    I do see the batch file left in place for install-win2 so I believe that the application is being run (such as it is... lol)...
    Any ideas what the problem might be? All reasonable suggestions (i.e. not PEBKAC) welcomed...
    Regards

    How about in Solaris?
    May I use the similar method to redirect the stdout to a specific file? What is the syntax for this?
    Or, I can only start server with interactive mode (without watchdog) and use ">" to redirect the logs?
    Thx a lot.

  • To redirect System.out stream output on swing's JTextArea

    Following is a program that needs to print output as follows:-
    EXPECTED OUTPUT ON GUI:_ In action block (datapayload value) In Routing block (argus value)
    PRESENT PROGRAM OUTPUT ON GUI_ In action block (datapayload value)
    please examine the below code and correct mistakes to get the expected output as given above.....
    I am not getting the second line as output on GUI i.e., In Routing block (argus value)
        import java.awt.*;
        import javax.swing.*;
        import java.awt.event.*;
        import java.io.*;
        public class Demo extends JFrame implements ActionListener
          JTextField datapayload;
          JLabel Datapayload;
          JButton submit;
          JTextArea textFieldName;
          public Demo()
             DemoLayout customLayout = new DemoLayout();     
             getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
             getContentPane().setLayout(customLayout);
             Datapayload = new JLabel("Enter DataPayload:");
             getContentPane().add(Datapayload);
             datapayload = new JTextField("abcd...");
             getContentPane().add(datapayload);
             submit = new JButton("submit");
             getContentPane().add(submit);
             textFieldName = new JTextArea(80,10);
             textFieldName.setEditable( false );
             JScrollPane scroll = new JScrollPane(textFieldName) ;
             scroll.setBounds( 10, 60, 225, 150 );
             getContentPane().add( scroll );
             submit.addActionListener(this);
             setSize(getPreferredSize());
           public void actionPerformed(ActionEvent e)
              String demodata=datapayload.getText();
                 textFieldName.append("In Action Block"+"\t"+demodata);  
              Demo pr = new Demo();                              
              pr.DemoRoute(demodata);
           public void DemoRoute(String argus)
                 textFieldName.append("In routing block"+"\t"+argus);
            public static void main(String args[])
                 Demo window = new Demo();
                 window.setTitle("Demo");
                 window.pack();
                 window.show();
        class DemoLayout implements LayoutManager
           public DemoLayout() {  }
           public void addLayoutComponent(String name, Component comp) {   }
           public void removeLayoutComponent(Component comp) {  }
           public Dimension preferredLayoutSize(Container parent)
             Dimension dim = new Dimension(0, 0);
             Insets insets = parent.getInsets();
             dim.width = 320 + insets.left + insets.right;
             dim.height = 240 + insets.top + insets.bottom;
             return dim;
           public Dimension minimumLayoutSize(Container parent)
             Dimension dim = new Dimension(0, 0);
             return dim;
           public void layoutContainer(Container parent)
             Insets insets = parent.getInsets();
             Component c;
             c = parent.getComponent(0);
             if (c.isVisible()) {c.setBounds(insets.left+90,insets.top+8,172,26);}
             c = parent.getComponent(1);
             if (c.isVisible()) {c.setBounds(insets.left+230,insets.top+8,172,26);}
             c = parent.getComponent(2);
             if (c.isVisible()) {c.setBounds(insets.left+230,insets.top+52,142,26);}
             c = parent.getComponent(3);
             if (c.isVisible()) {c.setBounds(insets.left+90,insets.top+100,472,268);}
        }  Edited by: 997189 on Mar 31, 2013 8:52 AM

    Hi,
    change your actionPerformed() method as below to get the required output.
    public void actionPerformed(ActionEvent e)
              String demodata=datapayload.getText();
                 textFieldName.append("In Action Block"+"\t"+demodata);  
              //Demo pr = new Demo();      You are creating a new object to all DemoRoute method. This is the problem                         
              //pr.DemoRoute(demodata);
                 this.DemoRoute(demodata);
    }And also my suggestion is follow java coding conventions while coding

  • Get console output

    Hi!
    I have a problem. I would like to get a hand on the console output in my applet. Not saving it to a file, but get the info as a String(or similar) in my program.
    Is this possible? If so, how do I do it? Is there any class(es) to handle this?
    Thanks in advance.
    Peter.

    Try this....u may need some customizing...what i'm presenting is an idea. You have to choose how to use it.
    regards,
    DeeJay
    import java.io.*;
    import javax.swing.*;
    public class IOTest {
         public static void main(String args[]) throws IOException {
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              PrintStream ps = new PrintStream(baos);
              System.setOut(ps);
              System.setErr(ps);
              System.out.println("Output");
              JOptionPane.showMessageDialog(null, new String(baos.toByteArray()));
              System.err.println("Error");
              JOptionPane.showMessageDialog(null, new String(baos.toByteArray()));
    }

  • How to :Logging or System.out.println????

    Hi,
    Iam not able to see any System.out.println output in SAP? where exactly can i see it? any configuration required to enable logging? if so how?? please help

    Hi Sujesh,
    see https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/events/webinars/using logging and tracing on the sap web as java.pdf pages 12-17 and pages 22-24.
    Also see http://help.sap.com/saphelp_nw04/helpdata/en/e2/75a74046033913e10000000a155106/frameset.htm for portal specific logging issues.
    Hope it helps
    Detlev

  • Where does System.out.println go?

    Hi Everyone: I know I've seen this topic before, but I'm still having some trouble. I would like to debug my EJBs, and so I've added some System.out.println statements to them. Where does that go? I've looked at the defaultTrace.trc files in the
    C:\usr\sap\P48\JC00\j2ee\cluster\server0\log
    folder, and haven't found any of the text that I think I am writing. I appreciate any guidance! Ian.

    Hi lan,
    I was facing the same question earlier, and now I think I have figured out one possible answer. Actually, where the System.out.println goes is up to the Server Admin to config. There is a default SYSTEM.OUT log controller ( under location controller side) pre-defined to cater for all System.out.println(). All the System.out.println() output is considered as INFO type log message. However, this default SYSTEM.OUT controller is not assigned with any real log destination, thus, we cannot find the output anywhere.
    If you goes to the log configurator (using Visual Admin), you can locate this SYSTEM.OUT controller , and add in a default (Anonymous) destionation for it . (you need to toggle on the advance edit mode from the top menu , then you can add modify the destination settings of a Controller).
    For Anonymous destionation, the println() output will sure go to the defaultTrace.trc (better view it using Log Viewer, instead of viewing it from the log file ).
    Or , you can define a separate file (e.g. c:\temp\myStd.log ) as the log destination ..
    Last but not the least, you need to set the ForceSingleTraceFile setting from 'YES' to 'NO' , then you can see your "myStd.log".
    To change the ForceSingleTraceFile , go to Visual Admin, J2EE server --> Kernel --> LogManager.
    Hope you find the above useful.

  • Lost System.out.println statements.

    Hi
    I have few system.out.println in my jsp which i am using in my JSP provider channel. but when I look at the portal server's /var/opt/SUNWam/debug/desktop.debug file, none are there.. I looked at the web server's access and error logs too, but it is not there also.. can somebody tell me how do it get those ?? do we have any other mechanism to put debug logs ?

    By default the binary which web server runs is uxwdog which eats up System.out.println output. If you want to see the System.out.println then you need to change the product binary from the start script of the portal server instance.
    - Go to <portal-install-dir>/SUNWam/servers/https-<instance-name> and open the start script
    - Change the PRODUCT_BIN=uxwdog to PRODUCT_BIN=ns-httpd , save the file
    - Run the script ./start to start the portal server
    Note : with ns-httpd ON the server will not leave that shell, and in the same window/shell you will be able to see all your System.out.println statements. To close the server you have to kill the server process with "kill -9 pids" command
    Alternate way is to use api inside your application or jsp:
    <%@page import="com.sun.portal.providers.jsp.JSPProvider, com.sun.portal.providers.*, com.sun.portal.providers.containers.*, com.sun.portal.providers.context.*" %>
    <% JSPProvider p=(JSPProvider)pageContext.getAttribute("JSPProvider");
    ProviderContext pc = p.getProviderContext(); %>
    <%-- after that you can use these lines any where in your jsp --%>
    <%
    pc.debugError("your error msg");
    pc.debugMessage("your msg");
    pc.debugWarning("your warning msg");
    %>
    The perticular mgs will be shwon in /var/opt/SUNWam/debug/desktop.debug file as per your "debugLevel" parameter setting in /etc/opt/SUNWps/desktop/desktopconfig.properties file. By default the debugLevel is set to error so only pc.debugError("error msg") will be shown.
    Sanjeev

  • System.out broke?

    I'm programming in linux and I've made a simple program that run's a GUI display. I added a menu item action listener and inside the action method it should print something or anything it doesn't matter. My only problem is that it never prints. Furthermore, I put a System.out before the System.exit in the File | Exit menu and it skips over that and exits the program with no output. When I put System.out's in the public static void main method it works fine, after the GUI starts, nothing prints. Any ideas?

    I'm programming in linux and I've made a simple
    program that run's a GUI display. I added a menu
    item action listener and inside the action method it
    should print something or anything it doesn't matter.
    My only problem is that it never prints.
    . Furthermore, I put a System.out before the
    System.exit in the File | Exit menu and it skips over
    that and exits the program with no output. When I
    put System.out's in the public static void main
    method it works fine, after the GUI starts, nothing
    prints. Any ideas?My experience in linux is limited, with none of it being in Java. However, long ago, printing in Unix from C, output got buffered until the OS decided it was ready to print. You could force it by doing a fflush.
    You can also do a flush in Java. Try:
    System.out.println( "OUTPUT HERE" );
    System.out.flush();and see if that forces the output.
    Good luck.
    World spins
    RD-R
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Timestamp in system out

    Is there a setting to tell WebLogic to prepend System.out.println() output with the current timestamp? So instead of:
    Print line 1
    Print line 2
    it would be something like:
    04/02/2009 17:21:53:0640 Print line 1
    04/02/2009 17:21:53:0643 Print line 2
    Thanks,
    ToddJ
    Edited by: ToddJ on Apr 2, 2009 5:28 PM

    The program is supposed to do electronic notarization such as intellectual property protection, verify the when is a Will declared etc.
    In the program, I apply a self generated eCert to generate a timestamp for the aforesaid purpose, however, I caught an exception when generate a CertPath. So any idea??

  • System.out from Java class not output to JSP

    I am using JSP to make a Java API web accessible. I include (package) java classes that write error messages to standard out when they catch an error. Works fine on the command line. Problem occurs when using in JSP. I include them with a page directive (importing the package) rather than use them as beans, since they do so much more than beans do, and since I use many of the classes in a single page.
    i.e.
    <%@ page import="OPS.*" %>
    When errors occur, messages to "standard out" (system.out) don't appear in the html output of the JSP. I don't know where they are going (they aren't in the web server's error log), but they aren't going where I expected them to (browser window).
    I figured that standard out was the browser (httpServletResponse). Where am I going wrong here?
    Basically, I have a class that connects to a database (call it db) and does queries/updates. I have a class (call it employee) that uses the db class. I have a jsp page that instantiates the employee class and executes method calls. The code in the db class that outputs SQL error messages (db class instantiated by employee class) never gets put in the browser window. Nor in the server log, nor the console.
    How can I get system.out calls in classes db and employee to get output to the browser? The JSP outputs all other code and is not freezing nor not flushing the buffer.
    Thanks!

    I also use an Iplanet over which I have little control. But I can log on via telnet. If I log on (I use Reflection) and run my pages, the errors show in the Reflection window. If you have telnet access to the server, you might want to give this a try.
    Another alternative would be to add a few lines to your classes that allow you to pass a reference to the jsp StringWriter from your jsp and use that to output the errors to the browser.

  • System.out.println not showing up in the console

    Hi,
    I've some System.out.println statements in a static block in a Stateless
    Session Bean. I could not see these outputs in the Weblogic console. I'm
    using Weblogic 5.1 Any one faced this problem before? any help is
    appreciated.
    Thanks & Regards,
    Nithi.

    Take a look in the weblogic log files they might be redirecting std out.
    "Ryan LeCompte" <[email protected]> wrote:
    >
    Hello Nithi,
    I'm all out of ideas, unfortunately! However, check out the following
    links for
    some possible insight into the problem:
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=60&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3d3df18e%40newsgroups.bea.com&rnum=69
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=70&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3977417b%40newsgroups.bea.com&rnum=71
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=200&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3bc20346%241%40newsgroups.bea.com&rnum=209
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi Ryan,
    Thanks for your reply and sorry for the long silence. I was on vocation.
    Thre problem still remains.I'm very sure that the EJB
    is deployed by WebLogic as I'm able to call some methods.
    and I'm also calling EJB methods from Servlet. But my
    System.out.println statments work fine in the Servlet and
    not inside EJB (or anyother classes used by EJB).
    Any one has faced similar problems? BTW am using WebLogic 5.1
    Thanks in advance,
    Regards,
    Nithi.
    "Ryan LeCompte" <[email protected]> wrote in message
    news:[email protected]...
    Hello Nithi,
    I find it strange that your System.out.println statements are beingexecuted from
    within your servlets, but not in your stateless session bean. Are
    you
    positive
    that your EJB is being located and deployed by WebLogic? The statementsin
    your
    static { } block should be executed as soon as the WebLogic class
    loader
    finds
    the class and loads it into the JVM. I would suggest examining theconsole
    and
    try to determine if your EJB is in fact being deployed. Are you invokingmethods
    on the EJB inside of your servlets? Are you using any logging frameworkfrom within
    the EJBs which would redirect output to a file?
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi Ryan,
    Thanks for your reply. The setting in the weblogic.properties is
    as
    follows.
    weblogic.system.enableConsole=true
    So, that tells me that I should see all the System.out.printlns right?
    (Pleasecorrect me if I'm wrong). I can see all the System.out.println
    from
    my
    servletand not from the Session Bean (even if the System.out.println
    is
    outside
    static block).
    Please let me know your thoughts.
    Thanks & Regards,
    Nithi.
    "Ryan LeCompte" <[email protected]> wrote in message
    news:[email protected]...
    Hello Nithi,
    Are you sure that you don't have WebLogic configured to redirect
    all
    messages
    to a file instead of the console? Are you able to see yourSystem.out.println
    statements when placed within other methods of your stateless sessionbean? Please
    be a bit more specific.
    Thank you,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi,
    I've some System.out.println statements in a static block in a
    Stateless
    Session Bean. I could not see these outputs in the Weblogic console.
    I'm
    using Weblogic 5.1 Any one faced this problem before? any helpis
    appreciated.
    Thanks & Regards,
    Nithi.

  • What does System.out.println("Hello world!");  when System.console()=null?

    Hello,
    the code below:
    if(System.console()!=null)
                outStream=System.out;
            else
                outStream=new PrintStream(new FileOutputStream(new File("BasicCardReaderManagerLog.log")));
            outStream.println(System.currentTimeMillis());
            outStream.println(System.out.toString());produce the following output, in the BasicCardReaderManagerLog.log file:
    1249991451796
    java.io.PrintStream@190d11
    So it looks like System.out is valid and usable, however, since the application as no console, where I can see the output ???
    Precision: I get this situation in the main function of a console application which I launch using Process.Start. Is there any way to get a console by this mean ?
    Best regards,
    Sebastien

    Based on [http://forums.sun.com/thread.jspa?messageID=10790600#10790600|http://forums.sun.com/thread.jspa?messageID=10790600#10790600]
    import java.util.*;
    public class Java {
         public static void main(String[] arg) throws Exception {
              String[] cmd = { "cmd.exe", "/C", "start", "java.exe" };
              List<String> l = new ArrayList<String>(Arrays.asList(cmd));
              l.addAll(Arrays.asList(arg));
              cmd = l.toArray(cmd);
              Process p = Runtime.getRuntime().exec(cmd);
    }

  • How to see console output in Sun Java(TM) System Web Server 6.1 SP7?

    Dear All,
    I am having Sun Java(TM) System Web Server 6.1 SP7 installed on Windows 2000 Prof.
    I have deployed few applications and they were running successfully.
    From debugging point of view, i like to see the output from System.out.println .
    Prior to SP7 there is a console which shows this output. But now the batch files only starts and stops the admin and site server services. Where to see for console output?
    Is there command like tail.exe of Weblogic awailable for Sun Java System Web Server or any setting to be done in Admin?
    Please revert.
    -Sameer

    Response headers can be found in srvhdrs pblock.
    Those can be manipulated by using set-variable
    http://docs.sun.com/app/docs/doc/820-1638/6nda01tea?l=en&a=view#abuis
    You can read more about these in
    Sun Java System Web Server 6.1 SP8 Administrator's Configuration File Reference
    http://docs.sun.com/app/docs/doc/820-1638?l=en
    and
    Sun Java System Web Server 6.1 SP8 NSAPI Programmer's Guide
    http://docs.sun.com/app/docs/doc/820-1643?l=en

Maybe you are looking for

  • Can we create a PO then post invoice prior to GRN being performed

    Can you please advise if there is a way to make the following scenario possible: Using t-code ME21N we create a PO for goods or services with limits (using po type NB) We would like to post the invoice and match it to the PO when it arrives even if t

  • Does anyone know how to add multiple pictures to a single frame in iMovie?

    Does anyone know how to add multiple pictures to a single frame in iMovie?

  • Ipod touch 5g stuck on headphone mode help

    my  little brother ipod is stuck on headphones mode n the music wont play at all but in ringtones it shows the ringtone on speaker but other then that the music wont play outloud or siri wont talk nothingg help me please what do i do to fix this?????

  • Can't start BIS in Q5

    Dear sir,  i purchased blackberry Q5. yesterday recharged my mobile and activate BIS plan from my service provider but it cannot be activated on blackberry device. So help me for activation. My blackberry PIN 2B3243B7 service provider airtel india. T

  • How to get leading zeroes in exponent of e-format

    In order to mimic an ancient file specification, am trying to write DBL numbers in e-format where the exponent is padded to two digits with leading zeroes. For example:  -1.15091E-03 Is there a simple format code that does this or do I need to write