Problem while reading special characters in java

Hi i am faving the follwing xml.
<ns1:dc_application_bullets>
<w:p wsp:rsidR="004E4084" wsp:rsidRPr="007024E6" wsp:rsidRDefault="000D5B97" wsp:rsidP="007024E6">
<w:r>
<w:rPr>
<w:rFonts w:ascii="Arial Unicode MS" w:fareast="Arial Unicode MS" w:h-ansi="Arial Unicode MS" w:cs="Arial Unicode MS" w:hint="fareast" />
<wx:font wx:val="Arial Unicode MS" />
<w:lang />
</w:rPr>
<w:t>������</w:t>
</w:r>
</w:p>
</ns1:dc_application_bullets>
no i ma trying to parse this XML using java program and jdom parser. when i try to read the special chacters and print then i ma getting ?? on the console.
how can i print on to the console as the one what they look.
any help is appreciated.

please any bosy throw some light on this.You first. Do you think we're mindreaders? Reading and printing code please.

Similar Messages

  • Problem in reading special characters

    Hi friends
    I am doing one program which read serial port data (for bar code reader) using java application.
    My program is working well and reading serial data but it is not displaying special characters.When i read through hyperterminal i can see all special characters but when see data throught the output of java program these special characters are missing...
    I don't know i am doing something wrong in stream or ???
    My code is
    [CODE]public void serialEvent(SerialPortEvent event) {
              System.out.println("before serialEvent");
              StringBuffer readBuffer1 = new StringBuffer();
              switch (event.getEventType()) {
              case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
                   System.out.println("Data empty:");
                   break;
              case SerialPortEvent.DATA_AVAILABLE:
                      byte[] readBuffer = new byte[100];
                      int r = 0;
                      try {
                           System.out.print("test"); 
                          //t inputStream = serialPort.getInputStream();
                         while((r = inputStream.read(readBuffer)) != -1) {
                            System.out.print(new String(readBuffer, 0, r));
                      } catch (Exception e) {
                         e.printStackTrace(System.out);
    }[/CODE]Please help

    Hi DrClap,
    Thanks for your reply.
    That article was helpful in understanding character conversions. And it works fine for JSPs.
    But when I tried to apply the same in JSF it does not work. May be this is not the right forum to dicuss JSF related things. But if you know how pageEncoding and contentType can be mentioned in JSF. I am using myfaces and I have tried <h:form id="SearchForm" acceptCharset="UTF-8" accept="text/html;charset=UTF-8">. Didnt work....

  • Problem in reading special characters � Microsoft symbols.

    Hi All,
    I have a text field where user can enter some string and search. Unusually/unfortunately users can copy/paste text from ms-word file and search for that entry in the database. Here they can even copy ms-word special symbols such as ellipsis (�), em dash(�), en dash(�). Since database has such (special character) entries we cannot restrict them from doing this (after all that is the requirement).
    Now the problem is when I read the text value in servlet/jsp I find that those special characters are replaced by question marks(?). Because of this database return �no rows found� though there are entries.
    What I have observed is when I read the ASCII value � (int)char I am able to get proper value. Using that I am having if else block to replace the question marks with proper symbols. But is there a direct way to do this? I even tried converting the string to another character set type string. But no luck.
    (Also when I print the text value to a JSP, I can see proper vales through Internet Browser.)
    Below is the sample program(read_n_print.jsp), sysout prints question marks in console, but JSP/HTML shows proper value in browser.
    <html>
    <%
         String value = request.getParameter("special_text");
         System.out.println("value " + value);
         if(value != null){
              byte[] bytes= value.getBytes();
              try {
                   String output = new String(bytes,"ISO-8859-1");     
                   System.out.println("output " + output);     
              } catch (Exception e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
    %>
    <head>
    <title>Insert title here</title>
    </head>
    <body>
    <form method="post" action="./read_n_print.jsp">
    <input type="text" name="special_text" value=""> <input type="submit" value="Go" > <br>
    <font size="8">Value entered is <%= value %></font>
    </form>
    </body>
    </html>

    Hi DrClap,
    Thanks for your reply.
    That article was helpful in understanding character conversions. And it works fine for JSPs.
    But when I tried to apply the same in JSF it does not work. May be this is not the right forum to dicuss JSF related things. But if you know how pageEncoding and contentType can be mentioned in JSF. I am using myfaces and I have tried <h:form id="SearchForm" acceptCharset="UTF-8" accept="text/html;charset=UTF-8">. Didnt work....

  • Problem with reading special characters in unix

    Hi,
    Iam trying to read the data from a file by the following code
    FileInputStream inputFile = new FileInputStream(xx);
    InputStreamReader reader = new InputStreamReader(inputFile);
    BufferedReader bufferedReader = new BufferedReader(reader);
    String s= bufferedReader.readLine();
    one of the line in file has the character �
    It working fine on windows, but on unix Iam getting it as ��.
    I tried with InputStreamReader contructor which accepts the charset name also, like by giving Cp1252, and latin1 etc, but iam not able to get around this problem.
    Any Ideas Please?

    ��This suggests to me that your input file is encoded in UTF-8. But that's only a guess, you need to find out for sure. Asking the person who produced the file would be the most reliable way. When you do find out, specify that encoding as the second parameter of the InputStreamReader constructor.

  • Encoding problem while reading binary data from MQ-series

    Dear all,
    we are running on 7.0 and we have an encoding problem while reading binary data from MQ-series. Because we are getting flat strings from queue we use module "Plain2ML" (MessageTransformBean) for wrapping xml-elements around the incoming data.
    The MQ-Series-Server is using CCSID 850, which we configured in connection parameters in communication channel (both parameters for Queuemanager CCSID and also CCSID of target).If there are special characters in the message (which HEX-values differ from codepage to codepage) we get errors in our adapter while executing, please see stack-trace for further analysis below.
    It seems to us that
    1. method ByteToCharUTF8.convert() expects UTF-8 in binary data
    2. Both CCSID parameters are not used anyway in JMS-adapter
    How can we solve this problem without changing anything on MQ-site?
    Here is the stack-trace:
    Catching com.sap.aii.af.mp.module.ModuleException: Transform: failed to execute the transformation: com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'sun.io.MalformedInputException'; nested exception caused by: sun.io.MalformedInputException caused by: com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'sun.io.MalformedInputException'; nested exception caused by: sun.io.MalformedInputException
        at com.sap.aii.af.modules.trans.MessageTransformBean.throwModuleException(MessageTransformBean.java:453)
        at com.sap.aii.af.modules.trans.MessageTransformBean.process(MessageTransformBean.java:387)
        at com.sap.aii.af.mp.module.ModuleLocalLocalObjectImpl0_0.process(ModuleLocalLocalObjectImpl0_0.java:103)
        at com.sap.aii.af.mp.ejb.ModuleProcessorBean.process(ModuleProcessorBean.java:292)
        at com.sap.aii.af.mp.processor.ModuleProcessorLocalLocalObjectImpl0_0.process(ModuleProcessorLocalLocalObjectImpl0_0.java:103)
        at com.sap.aii.adapter.jms.core.channel.filter.SendToModuleProcessorFilter.filter(SendToModuleProcessorFilter.java:84)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.ConvertBinaryToXiMessageFilter.filter(ConvertBinaryToXiMessageFilter.java:304)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.ConvertJmsMessageToBinaryFilter.filter(ConvertJmsMessageToBinaryFilter.java:112)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.InboundDuplicateCheckFilter.filter(InboundDuplicateCheckFilter.java:87)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.TxManagerFilter.filterSend(TxManagerFilter.java:123)
        at com.sap.aii.adapter.jms.core.channel.filter.TxManagerFilter.filter(TxManagerFilter.java:59)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.DynamicConfigurationFilter.filter(DynamicConfigurationFilter.java:72)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.PmiAgentFilter.filter(PmiAgentFilter.java:66)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.InboundCorrelationFilter.filter(InboundCorrelationFilter.java:60)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.JmsHeadersProfileFilter.filter(JmsHeadersProfileFilter.java:59)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageInvocationsFilter.filter(MessageInvocationsFilter.java:89)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.JarmMonitorFilter.filter(JarmMonitorFilter.java:57)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.filter.ThreadNamingFilter.filter(ThreadNamingFilter.java:62)
        at com.sap.aii.adapter.jms.core.channel.filter.MessageFilterContextImpl.callNext(MessageFilterContextImpl.java:195)
        at com.sap.aii.adapter.jms.core.channel.SenderChannelImpl.doReceive(SenderChannelImpl.java:263)
        at com.sap.aii.adapter.jms.core.channel.ChannelImpl.receive(ChannelImpl.java:437)
        at com.sap.aii.adapter.jms.core.connector.MessageListenerImpl.onMessage(MessageListenerImpl.java:36)
        at com.ibm.mq.jms.MQMessageConsumer$FacadeMessageListener.onMessage(MQMessageConsumer.java:399)
        at com.ibm.msg.client.jms.internal.JmsMessageConsumerImpl$JmsProviderMessageListener.onMessage(JmsMessageConsumerImpl.java:904)
        at com.ibm.msg.client.wmq.v6.jms.internal.MQMessageConsumer.receiveAsync(MQMessageConsumer.java:4249)
        at com.ibm.msg.client.wmq.v6.jms.internal.SessionAsyncHelper.run(SessionAsyncHelper.java:537)
        at java.lang.Thread.run(Thread.java:770)
    Caused by: com.sap.aii.messaging.adapter.trans.TransformException: Error converting Message: 'sun.io.MalformedInputException'; nested exception caused by: sun.io.MalformedInputException
        at com.sap.aii.messaging.adapter.Conversion.service(Conversion.java:714)
        at com.sap.aii.af.modules.trans.MessageTransformBean.processTransform(MessageTransformBean.java:538)
        at com.sap.aii.af.modules.trans.MessageTransformBean.processTransform(MessageTransformBean.java:528)
        at com.sap.aii.af.modules.trans.MessageTransformBean.processTransform(MessageTransformBean.java:471)
        at com.sap.aii.af.modules.trans.MessageTransformBean.process(MessageTransformBean.java:364)
        ... 36 more
    Caused by: sun.io.MalformedInputException
        at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:270)
        at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:287)
        at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:337)
        at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:223)
        at java.io.InputStreamReader.read(InputStreamReader.java:208)
        at java.io.BufferedReader.fill(BufferedReader.java:153)
        at java.io.BufferedReader.readLine(BufferedReader.java:316)
        at java.io.LineNumberReader.readLine(LineNumberReader.java:176)
        at com.sap.aii.messaging.adapter.Conversion.convertPlain2XML(Conversion.java:310)
        at com.sap.aii.messaging.adapter.Conversion.service(Conversion.java:709)
        ... 40 more
    Any ideas?
    Kind regards, Stefan

    Hi Stefan,
    for the first MTB now we are using only one parameter: Transform.ContentType = text/plain;charset="ISO-8859-1"
    The second MTB, which does the XML-Wrapping, is configured like this:
    Transform.Class = com.sap.aii.messaging.adapter.Conversion
    Transform.ContentType = application/xml
    xml.conversionType = SimplePlain2XML
    xml.fieldNames = value
    xml.fieldSeparator = §%zulu§%
    xml.processFieldNames = fromConfiguration
    xml.structureTitle = payload
    Both CCSID configuration parameters from the "Source"-Tab we've set to 850.
    Now, we don't get an error anymore - sun.io.malformedInputException - , but, unfortunately, now special character conversion succeeded (we need an "ß" and we get an ISO-HEX-E1 -> á).  E1 is (different from ISO) an "ß" in 850.
    Any ideas?

  • ### Problem in retrieving special characters with Oracle 9i JDBC drivers

    hi,
    We are having some problem with retrieving special characters like '�' from the database.
    Our application is using JDK1.3.1 with Oracle 9i at the back end(Version: 9.0.1.0.0). We are using oracle 9i thin drivers (classes12.zip) for database interaction.
    To relieve the data from database we are using PreparedStatement in two ways
    1. Creating a preparedstatement from connection object without any parameters and then retrieve the
    data using it. This gives the results in correct format i.e. special characters like '�'
    2. Create the preparedstatement by passing the following parameters.
    i) ResultSet.TYPE_SCROLL_INSENSITIVE
    ii) ResultSet.CONCUR_READ_ONLY
    In this case we are not able to retrieve the special character like '�' correctly. Instead the ResultSet
    returns 'h'
    I think this is the problem with Oracle drivers. Does anyone have any information about the mentioned problem.
    rgds

    I don't know exactly (because I am using JDK 1.4 with ojdbc14.jar where these problems seem to be rare...) but you may consider this:
    1. Add nls_charset12.zip to your classpath to ensure that the encoders are present (may or may not help)
    2. Swith to JDK 1.4, and do this:
    Instead of String s = getString(column)
    use
    byte[] bytes = getBytes(column);
    ByteBuffer bb = ByteBuffer.wrap(bytes); // in package java.nio
    CharBuffer cb = Charset.forname("ISO-8859-x").decode(bb);
    String s = cb.toString();
    The latter method allows you to perform the encoding/decoding manually.
    3. Change the character encoding in the database to unicode upon database setup.
    4. Try playing with NLS parameters (alter session ...)

  • I am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g

    i am facing problem while reading values from properties file ...i am getting null pointer exception earlier i was using jdeveloper10g now i am using 11g

    hi TimoHahn,
    i am getting following exception in JDeveloper(11g release 2) Studio Edition Version 11.1.2.4.0 but it works perfectly fine in JDeveloper 10.1.2.1.0
    Root cause of ServletException.
    java.lang.NullPointerException
    at java.util.PropertyResourceBundle.handleGetObject(PropertyResourceBundle.java:136)
    at java.util.ResourceBundle.getObject(ResourceBundle.java:368)
    at java.util.ResourceBundle.getString(ResourceBundle.java:334)
    at org.rbi.cefa.master.actionclass.UserAction.execute(UserAction.java:163)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)
    at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
    at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
    at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
    at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
    at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)

  • Problem  while reading XML file from Aplication server(Al11)

    Hi Experts
    I am facing a problem while  reading XML file from Aplication server  using open data set.
    OPEN DATASET v_dsn IN BINARY MODE FOR INPUT.
    IF sy-subrc <> 0.
        EXIT.
      ENDIF.
      READ DATASET v_dsn INTO v_rec.
    WHILE sy-subrc <> 0.
      ENDWHILE.
      CLOSE DATASET v_dsn.
    The XML file contains the details from an IDOC number  ,  the expected output  is XML file giving  all the segments details in a single page and send the user in lotus note as an attachment, But in the  present  output  after opening the attachment  i am getting a single XML file  which contains most of the segments ,but in the bottom part it is giving  the below error .
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/SHPORD_0080005842.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    for all the xml  its giving the error in bottom part ,  but once we open the source code and  if we saved  in system without changing anything the file giving the xml file without any error in that .
    could any one can help to solve this issue .

    Hi Oliver
    Thanx for your reply.
    see the latest output
    - <E1EDT13 SEGMENT="1">
      <QUALF>003</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803</NTEND>
      <NTENZ>000000</NTENZ>
      <ISDD>00000000</ISDD>
      <ISDZ>000000</ISDZ>
      <IEDD>00000000</IEDD>
      <IEDZ>000000</IEDZ>
      </E1EDT13>
    - <E1EDT13 SEGMENT="1">
      <QUALF>001</QUALF>
      <NTANF>20110803</NTANF>
      <NTANZ>080000</NTANZ>
      <NTEND>20110803<The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    Invalid at the top level of the document. Error processing resource 'file:///C:/TEMP/notesD52F4D/~1922011.xml'.
    /SPAN></NTEND>
      <NTENZ>000000</NTENZ>
    E1EDT13 with QUALF>003 and  <E1EDT13 SEGMENT="1">
    with   <QUALF>001 having almost same segment data . but  E1EDT13 with QUALF>003  is populating all segment data
    properly ,but E1EDT13 with QUALF>001  is giving in between.

  • Problem with Icelandic special characters on Mac

    Hello
    I am working on a Flash publication for students, and I want it to run on Mac as well as PC. Everything goes fine, except a problem with three special characters in my language, Icelandic. I am working on a registration and login page where I am using text boxes and text input boxes. Everything looks correct on PC, but on Mac the characters Þ Ð Ý are lost.
    I have tried different fonts etc.
    Any idea what is wrong?
    Jónas Helgason

    Hello Jónas,
    Did you ever figure this out ?
    I have a similar problem except only with two letters (both upper and lower case).  These two Icelandic letters can't be entered into a Flex TextInput box in the Flex apps I am creating when they are loaded on a Mac.  The letters are known as &Eth, &eth, &Thorn and &thorn in HTML terminology.  Typing these characters on the keyboard results in the following:  { [ ? /
    However I can copy the characters in question from some other app like TextEdit and paste them into a TextInput box in my Flex app and all is well, they show up correctly.
    This happens regardless of the Mac browser used and the Flash plugin version used (have tried both 9 and 10) and also happens in the standalone Flash Player application.
    Does anyone have any idea how to fix this or is this a bug in Flash Player ?  This is really annoying as it makes text input into Flex apps on Icelandic Macs very difficult.
    There must be something wrong with the mapping of keyboard key codes into character codes on the Mac that is causing this.
    Btw, I just heard from a friend that this problem does not exist in MacOS 10.6.  I am running 10.4 and have tested this on 10.5 and it exists on both of those OS versions.
    Rgds,
    Hordur Thordarson
    Lausn hugbunadur
    http://lausn.is

  • Problem while reading data from Serial Port

    Hi All,
    I am facing some problem while reading data from Serial Port.
    As per the requirement I am writing the data on Serial Port and waiting for response of that data.
    Notification for data availabilty is checked with method public void serialEvent(SerialPortEvent event) of javax.comm.SerialPortEventListener.
    When we are writing data on the port one thread i.e. "main" thread is generated and when data availability event occures another thread "Win32SerialPort Notification thread" is generated. This creates problem for me as we can't control thread processing.
    So can anybody pls explain me how to overcome this problem?
    Regards,
    Neha

    My Problem is:-
    I am simoultaneouly wrting data on port & reading data from port.
    First I write data on port using outputStream.write() method. Now when target side sends me response back for the request on serial port DATA_AVAILABLE of SerialPortEventListner event occured,we are reading data from serial port.Now till the time we didn't get the response from target next command can't be written on the serial port. When we are writing data on port main thread is executed.Now my problem starts when DATA_AVAILABLE event occured.At this point another thread is created.Due to this my program writes data of next command without reading response of previous command.To solve this prob. I have used wait() & notify() methods as follows.But again due to this my pc hangs after execution of 2 commands. (PC hang in while loop in a code provided below.)
    From SOPs I could figure it out that after 2 commands we are not able to write data on serial port so DATA_AVAILABLE event doesn't occure n pro. goes in wait state.
    Can anybody help me to solve this issue.
    Neha.
    Code:
    public void serialEvent(SerialPortEvent event)
              switch (event.getEventType())
                   case SerialPortEvent.BI:
                   case SerialPortEvent.OE:
                   case SerialPortEvent.FE:
                   case SerialPortEvent.PE:
                   case SerialPortEvent.CD:
                   case SerialPortEvent.CTS:
                   case SerialPortEvent.DSR:
                   case SerialPortEvent.RI:
                   case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
                                 break;
                   case SerialPortEvent.DATA_AVAILABLE:
                        try
                             dataThread = Thread.currentThread();
                             dataThread.setPriority(10);
                             dataAvailable = true;
                                                                                    byte[] tempArray=new byte[availableBytes];
                                        inputStream.read(tempArray);
                                                                       catch (IOException io)
                             SOP(io, "Error in serialEvent callback call for event DATA_AVAILABLE");
    public void  writetoPort(byte[] data) throws IOException
                             outputStream.write(data);
                              while(finalTimeOut >= actualTime)
                            if( ! dataAvailable)
                                    actualTime = System.currentTimeMillis();
                           else
              synchronized (mainThread)
                   mainThread = Thread.currentThread();
                   mainThread.wait();
    public  void sendDatatoUser(byte[] b) throws Exception, HWCCSystemFailure
              obj.returnData(b);
              synchronized(mainThread)
                   mainThread.notify();
                                                           

  • Reading special characters from a flat file and inserting into DB

    I'm reading data with special characters like . etc from a flat file , assigning the data to variable in my anonymous block and inserting into my DB. But the show up as inverted ? s. Any clues about how to do this?
    If i try to do the insert directly it works. It seems like the error occurs when reading this data into a variable
    thanks for the help
    Lalit Bhatia

    lalit, this is probably an character set problem, the default on Database creation tends to be 7bit Ascii which does not support special characters, it's been a while since I set up a db in this way, but you need to change settings in oracle.ini. The db will need to be restarted for this. Also, to check current settings try:
    select * from NLS_DATABASE_PARAMETERS
    You want an 8bit, unicode or multibyte character set. Sorry I cannot remember moer off the top of my head, try searching on NLS or character set

  • Can't read special characters in an excel file using JDBC

    Hi! I 've a code to read an excel file using JDBC-ODBC bridge. I can read the values, but any special characters is readed wrong, just symbols. The special characters are of spanish language. This is my code:
                    Locale currentLocale;
              currentLocale = new Locale("es", "MX");
              Locale.setDefault(currentLocale);
                   Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
                   c = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=comisionesperfiles.xls");
                   stmnt = c.createStatement();
                   String query = "Select * from [Hoja1$]" ;
                   ResultSet rs = stmnt.executeQuery( query );
                   while( rs.next() ){
                        String valor = rs.getString(2) ;
                        if(valor != null && !"null".equalsIgnoreCase(valor)){
                             if(!comisiones.contains(valor)){
                                  System.out.println(valor);
                                  comisiones.add( valor );
                   rs.close();
                   stmnt.close();As you can see, I've tried to set the locale, but it didn't work.
    I'm using Excel 2003, Java Version 1.4.2_07 and Windows XP Professional (in latin american spanish).
    Hope someone can help me!

    FYI: Apache's POI can read/write Excel files in Java:
    http://jakarta.apache.org/poi/index.html

  • Mysql problem with german special characters

    hi,
    I wrote a software and it worked quite good, but after I installed it on a new machine with j2se 1.4 I've problems with the german special characters.
    this code works good on the old machine (jdk 1.3.1) and prints the wanted characters like �,�,�.
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    java.sql.Connection conn;
    conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?user=testuser&password=xxxx");
    Statement s = conn.createStatement();
    ResultSet r = s.executeQuery("select something from testtb where id='1'");
    r.first();
    System.out.println( r.getString(1) );
    but on the new machine (j2se 1.4) I only receive the character ?.
    I updated my org.gjt.mm.mysql to the current MySQL Connector/J 3.0.9 and added
    conn = DriverManager.getConnection("jdbc:mysql://localhost/testdb?user=testuser&password=xxxx&useUnicode=true&characterEncoding=ISO-8859-1");
    but I've got still the same problem.
    Thanks in advance
    Markus

    with "wanted characters like �,�,�"
    I meant: like &#x00E4;,&#x00FC;,&#x00F6;

  • Jar (or Zip) file with problems in accents, special characters

    Hi! I've a servlet that creates a jar (or zip) file and then send it. My problem is that when I create an entry in which the filename has special characters such as accents, when I unjar or unzip de file, it brings a lot of garbage characters. For example, the nex entry:
    Ex�menes.doc
    when unzipped is:
    Ex?�menes.doc
    I've tried a lot of things:
    -Setting the locale to ES, MX
    -Replacing all the letters with special characters with its unicode (like s.replace('�','\u00E1')
    -Trying to convert it to UTF8 (new String(path.getBytes(),"UTF8") )
    -Replacing the file separator char (according to a workaround that I found in the bug database)
    But nothing of this worked, alone or together. I've read that this is (or was) a bug in the API, but don't know if a solution has been found.
    Any help will be greatly appreciated!

    It's not clear what you are asking. Maybe this will help
    http://www.cfdev.com/code_samples/code.cfm/CodeID/83/Java/Simple_Ant_build_xml_Build_Task

  • Error while handling special characters ( and &) in Sender File adapter

    Dear All,
    Scenario: Third Party System --> (File adapter) SAP PI 7.1 (SP05) --> (Proxy) ECC
    We are receiving CSV file and no mapping is required in PI as all the processing is being done by third party tool. But we are receiving special characters like ',",>,< and & in the csv file.
    When we are using File Type as TEXT and File Encoding as ISO-8859-1 than we are getting error. We changed File Type to BINARY and than we are able to handle ',",> but having issue in handling < and &.
    Any idea how we can handle it.
    Please note trhere is no Mapping in SAP PI so cannot uise Java mapping.
    Thanks a lot
    Chanakya

    Hey,
    You can add ABAP Script in Receiver Proxy for eliminating or replacing with NULL or empty. Since you dont have mapping for formatting these kind of junks you can follow the above approach.
    Else, you can remove the junks at OS level while running a small script and make it available to PI.
    Or else, you need to create mapping for sender and recevier structure though it is same, then you add a very simple UDF for fine tune.
    Use this UDF
    Here a is the input value.
    String b = "";
    b = a.replaceAll(",", "0");
    b = a.replaceAll("@", "0");
    Like all the special characters you can take and replace with zero.
    return b;
    Thanx
    Pothana

Maybe you are looking for