Uploading file - unicode file type gives error

Hello,
I am trying to upload an xml file.
If the file is of ASCii format I can import this file ,but if the file format is changed to unicode or utf-16 I get sax parser error.
I noticed one thing though,ascii file seems to appear in this format
<?xml version="1.0" encoding="UTF-8"?>
<addresses>
<address>
<street-name>22 11th ave SW</street-name>
<city>Dynotopia</city>
</address>
</addresses>
Where as when I change the file format to unicode it appears like this
?< ? x m l v e r s i o n = " 1 . 0 " e n c o d i n g = " U T F - 8 " ? >
< a d d r e s s e s >
< a d d r e s s >
< s t r e e t - n a m e > 2 2 1 1 t h a v e S W < / s t r e e t - n a m e >
< c i t y > D y n o t o p i a < / c i t y >
< / a d d r e s s >
< / a d d r e s s e s >
?< ? x m l v e r s i o n = " 1 . 0 " e n c o d i n g = " U T F - 8 " ? >
< a d d r e s s e s >
< a d d r e s s >
< s t r e e t - n a m e > 2 2 1 1 t h a v e S W < / s t r e e t - n a m e >
< c i t y > D y n o t o p i a < / c i t y >
< / a d d r e s s >
< / a d d r e s s e s >
Can some one guide me to automate this process so that my sax processor automatically set itself to the appropriate file format?
or is it possible at all?

Thanks DrClap,
I read the article ( from the link u reffered).
Here is my problem,
I am uploading an xml file, here is the code
if(req.getContentLength() > 0) {
BufferedReader reader = req.getReader();
String line = reader.readLine();
if((line == null) || (line.indexOf(boundary) == -1)) {
//error generator
StringBuffer part = new StringBuffer();
while((line = reader.readLine()) != null) {
if(line.indexOf(boundary) == -1) {
part.append(line + "\n");
} else {
parts.add(part.toString());
part = new StringBuffer();
now my guess is when we convert an ASCii type to string above it works fine,but when the type is otherthen ASCii the conversion of file to string screws up...
can u pls guide me to make it work so it doesn't.

Similar Messages

  • CLOB type give error in procedure

    I have 1 procedure with 3 argument,In this 1 argument is of type CLOB.
    When i call procedure then it give error Of character set problem.
    But when i remove the CLob argument the procedure executed successfuly.
    I am using this procedure in Oracle8i
    Why this happen? what to do to solve this?

    Hi,
    It is working for me in Oracle8i/ 9i. What exactly your procedure is doing?
    1 create or replace procedure test_clob(ch clob)
    2 is
    3 begin
    4 dbms_output.put_line(ch);
    5* end;
    SQL> /
    SQL> exec test_clob('mmmm');
    mmmm
    PL/SQL procedure successfully completed.
    is your procedure trying to APPEND clob into another clob?
    Thanks
    M Thiyagarajan

  • Update to read raw files from Panasonic GH4 gives error Code U44M1I216??

    Trying to view Raw files from the new Panasonic GH4; CS6 won't open them.  I tried Help>Update and got 5 updates available.  Downloaded and attempted installation but got the error code above.  Did as directed in some forum posts--Library>Application Support>Adobe>AAMUPdater and deleted the AAMUpdater file.  Closed PS and Bridge, reopened, and still no good.  Thanks in advance for any help with this!
    Steve Smith

    Error U44M1I216 when updating applications

  • Period Type gives error in ESS when is set to 3 (Bi-weekly)

    Hi all,
    When I set the Period type in the Profile to 3 (Bi-weekly) I receive the following error while recording time in the Portal.
    Error: PROFILE_NOT_INITIALIZED
    It's also happen for period time 1 and 4, but not for period time 2 (Weekly).
    In R/3 it's work fine. Any idea why is this? Or how can it be solved??
    I need to use Period type 3.
    Thanks in advance!

    Hi,
    I did not solved the problem. You did it ...
    I was trying to implement ESS for CATS, and this was not working, I saw your thread, and tried wat was working for you.
    This was at this time (ESS implementation is a Proof Of Concept at this stage) sufficent for us to have perform screenshots.
    I did never put any development request, but my understanding is that SAP improves his product based on customer's requests. If many users request the same, they will develop this in a next release. So this should be free of charge, if you wait until it becomes standard.
    But I would not confirm the message untill they takes the engagement of the developments, as this is a bug from my point of view. Is this limitation described in the documentation ? No ? => this is a bug ...
    Vincent

  • Upload unicode file and display content in a textarea

    Hi all,
    I am trying to do the following;
    1. upload a unicode file (file with some non-english characters)
    2. after uploading, read the uploaded file and show the content in a textarea in a jsp page.
    I use struts in my project. I use class org.apache.struts.upload.FormFile for uploading the file. The upload works fine. I do the upload with help of FormFile's getInputStream method. When i read and display the content in the textarea, the content is displayed junk. But i tried to open the uploaded file, its fine. I mean it is just as my source file. Please help me out for reading the uploaded unicode and displayed in a textarea.
    Below is the code that i use to upload the file;
    File tempFile = null;
    FileOutputStream fos = null;
    InputStream is = null;
    try {
         tempFile = "c:/ThaiText.txt";
         fos = new FileOutputStream(tempFile);
         is = theFile.getInputStream();
         // Transfer bytes from in to out
         byte[] buf = new byte[1024];
         int len;
         while ((len = is.read(buf)) > 0) {
              fos.write(buf, 0, len);
         logger.info("fileName$$=" + tempFile.getName());
    } catch (Exception e) {
            logger.error(e);
         throw e;
    } finally {
         closeOutputStream(fos);
    }Below is the code that i use for reading the uploaded file's content and store it to a string. I set this string to a form bean's string property.
    public static String readContentNonUTF8(String path) {
         FileInputStream fis = null;
         String value = "";
         try {
              fis = new FileInputStream(path);
              byte[] buf = new byte[1024];
              int len;
              while ((len = fis.read(buf)) > 0) {
                   String tmp = new String(buf, 0, len);
                   value = value.concat(new String(tmp.getBytes()));
         } catch (Exception e) {
              logger.error(e);
         } finally {
              try {
                   fis.close();
              } catch (Exception e) {
         return value;
    }

    Hi,
    Thanks for your reply. You meant that both method also can used to upload file and submit data? How about if i want to use the first method to upload file and submit data? How can i upload the file by using first method?

  • Special characters being read from the unicode file for greek language

    Hi All,
    I have a report which would upload a unicode file and then update the vendor master data accordingly.
    The file contains greek characters too.
    when the file is being read in the code, some special characters are being added up to the vendor number which is the first entry. The special characters are not included in the file , but are added up only to the first vendor number and not any other vendor numbers.
    The logic that is being used is as follows :
    TRY.
          IF unicode IS INITIAL.
            IF codepage IS INITIAL.
    *-->      For backward compatibility where this FM might be called from
    *         other dependent objects (FMs/dynamic subroutines)
    *         which donot have access to  user's input w.r.t Unicode parameters
              OPEN DATASET filename FOR INPUT
                   IN LEGACY TEXT MODE
                   MESSAGE msg
                   REPLACEMENT CHARACTER repl_char
                   IGNORING CONVERSION ERRORS
                   FILTER filter.                         
            ELSE.
    *--> System in non-unicode and Unicode Environment (Phases I and II)
              OPEN DATASET filename FOR INPUT
                   IN LEGACY TEXT MODE CODE PAGE codepage MESSAGE msg
                   REPLACEMENT CHARACTER repl_char
                   IGNORING CONVERSION ERRORS
                   FILTER filter.                          
            ENDIF.
          ELSE.
    *-->  Extract File in Unicode format - Phase III
            OPEN DATASET filename FOR INPUT IN TEXT MODE ENCODING UTF-8
            MESSAGE msg
            FILTER filter.                                 
          ENDIF.
          IF sy-subrc NE 0.
            MESSAGE e001(zuni) WITH filename sy-subrc
             RAISING file_open_error.
          ENDIF.
    the unicode parameters used are : codepage = 8000.
    An early reply is most appreciated.
    Regards,
    Manu.

    Please check SAP notes for Eastern European Characters in Unicode system. and may be below code helps you
    DATA:
        ltp_bom                  TYPE sychar01,
        ltp_encoding             TYPE sychar01,
        ltp_codepage             TYPE cpcodepage.
    Processing --------------------------------------------------------- *
      TRY.
          CALL METHOD cl_abap_file_utilities=>check_utf8
            EXPORTING
              file_name         = itp_filename
              max_kb            = -1
              all_if_7bit_ascii = abap_true
            IMPORTING
              bom               = ltp_bom
              encoding          = ltp_encoding.
        CATCH cx_sy_file_open .
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                  RAISING file_open_error.
        CATCH cx_sy_file_authority .
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                  RAISING file_authority_error.
        CATCH cx_sy_file_io .
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
                  RAISING file_io_error.
      ENDTRY.
      CASE ltp_encoding.
        WHEN cl_abap_file_utilities=>encoding_utf8
          OR cl_abap_file_utilities=>encoding_7bit_ascii.
          CASE ltp_bom.
            WHEN cl_abap_file_utilities=>no_bom.
              OPEN DATASET itp_filename FOR INPUT IN TEXT MODE
                ENCODING UTF-8.
            WHEN cl_abap_file_utilities=>bom_utf8.
              OPEN DATASET itp_filename FOR INPUT IN TEXT MODE
                ENCODING UTF-8
                  SKIPPING BYTE-ORDER MARK.
            WHEN cl_abap_file_utilities=>bom_utf16_be.
              ltp_codepage = '4102'.
              OPEN DATASET itp_filename FOR INPUT IN LEGACY BINARY MODE
                BIG ENDIAN CODE PAGE ltp_codepage.
            WHEN cl_abap_file_utilities=>bom_utf16_le.
              ltp_codepage = '4103'.
              OPEN DATASET itp_filename FOR INPUT IN LEGACY BINARY MODE
                LITTLE ENDIAN CODE PAGE ltp_codepage.
            WHEN OTHERS.
              OPEN DATASET itp_filename FOR INPUT IN TEXT MODE
                ENCODING UTF-8.
          ENDCASE.
        WHEN OTHERS.
          OPEN DATASET itp_filename FOR INPUT IN LEGACY TEXT MODE.
      ENDCASE.
    Edited by: Nilesh Shete on May 7, 2010 5:29 PM

  • Weblogic with Hibernate gives error of named queries ? urgent

    I have deployed my application on Weblogic 11g, it gives Hibernate Names query exception.
    My Application uses Hibernate 3.0 and it works successfully on
    Tomcat
    JBOSS
    Glassfish
    But , on weblogic it gives Named query exception .Please any once can help.
    I have put antlr-3.0 jar file in lib folder of Weblogic domain folder , and have added path of it in setDomainEnv.cmd file but still Hibernate gives error of named query.

    You can follow the steps presented here: http://middlewaremagic.com/weblogic/?p=5861
    The reason for the failure is the antlr library, which is already loaded through the system classpath, so you
    need to tell WebLogic which version is should load as Hibernate uses its own implementation of the antlr library.
    Adding it to the domain/lib directory does not help as jar files placed in this directory are added at the end of the system classpath at the end.
    Note that it is not good practice to place jar files in the domain/lib directory.

  • Has anyone been able to upload an ibooks file with audio only files (m4a) in it? I keep getting the following error message during the upload in iTunes Producer: ERROR ITMS-9000: "Files of type audio/x-m4a are not allowed outside of widgets.

    Has anyone been able to upload an ibooks file with audio only files (m4a) in it? I keep getting the following error message during the upload in iTunes Producer: ERROR ITMS-9000: "Files of type audio/x-m4a are not allowed outside of widgets. then it names the file as an m4p file. Everything works beautifully on the iPad through Preview, and validates through iTunes Producer up until the attempted upload. If you've been able to accomplish this, please let me know how you prepared your audio files. Many thanks.

    Hello Fellow iBook Authors!
    Today I received the same error that you all have been discussing.  I tried selecting the DRM
    and this did not work for me, though I'm glad it did for some.  Here's what I did as a work-around. . .
    Since iBooks Author did not have a problem with Videos, I simply used one of my video programs, ScreenFlow to turn the audio into a video file m4v.  I added an image and extended the length or timing of the image to span the length of the audio file.  Then exported as an .mov.  I then opened QuickTime and opened the file and exported the file to iTunes. 
    You can use iMovie, Camtasia or any other progam that will allow you to export the audio as a movie file.  Does this make sense?  I hope this helps, at least in the short-term.
    Michael Williams

  • Files generated by Web Service Proxy give errors for complex input types

    Hi ,
    I generated a Java Web Service Proxy using a WSDL file.
    The input params are of this fashion -
    1) Object 1 have 3 attributes
    2) Object 2 having nested Object 2 (yes , again) which has a nested attribute which needs to be passed say Param 1.
    When I generate the proxy classes ... Param 1 is referred to as private Object2.Object2 param1 which gives error for the data types.
    How can we resolve this .. what should be the correct data type representation for param 1 ?
    Thanks

    Issue was resolved . Details here - 11g PS2 - WebServiceProxy Class give errors for complex input types

  • 'This file type is not allowed...' error on uploading CX Archive file

    On uploading modified jar file to the exisiting CX archive path, it says 'This file type is not allowed. Please choose another file.'. This issue occurs only in the TEST environment while the error is not thrown in DEV. Any idea why this might be? Tried renaming it to .zip, but it did not help either. Thanks in advance.

    Here is the Response from our DBA. "I reviewed those docs (Notes 1432305.1 & 1357849.1 ) and these file format already included in Jan Security patches".
    Did your DBA follow the instructions in Note 1357849.1 to change the security structure to allow .jar files?
    It looks like we already have both January and April security Patches applied on the environment but we are still facing this issue. We are not facing this error in another Instance Where we don't have these security patches applied. Any direction?Please see Note: 1357849.1 and make sure the solution is implemented. If you still get the same issue, please log a SR.
    Thanks,
    Hussein

  • I have exported my bookmarks in JASON format now when I restore this one its gives error " Unsupported file type"

    I have exported my bookmarks in JASON format now when I restore this one its gives error " Unsupported file type"

    Hello UbaidUQ, any luck if you rename the file with no capital letters = .json, (no .JSON)
    thank you

  • Firefox 7.0 - Can not upload the file from local machine to server...gives "error 404 : file not found"

    firefox 7.0 - Can not upload the file from local machine to server...gives "error 404 : file not found"

    you have not understood my point
    how does this code will run on servlet when I want to upload a file from client's
    machine to server machine
    what I am doing is I am giving an option to the user that he/she can browse the file and then select any file and finally it's action is post in the jsp form for which I have sent the code
    All the computers are connected in LAN
    So how to upload a file from client's machine to server's machine
    Plz give me a solution

  • Muse wont export my files in html and gives an error code when trying to upload to BC

    Here is the error message I get but when we go to correct the file and replace it in Muse we still are getting this message.

    Hi,
    Can you provide me the url of your site ?
    Also, Please do a fresh upload of your site files to your server and this time make sure that you are not missing on any of the files that was generated by Muse.
    And you dont need to upload the .oam files onto your server separately as the files generated by Muse on exporting contains all the HTML , CSS and Javascript used in your Edge Animation.
    Regards,
    Rohit Nair

  • When  I am uploading  file with special character it gives error

    Hi All,
      I am uplloading one file with special character then it gives error. Please let me know solutions on this is soon as possible.
    Thanks,
    Madhav

    hi are you looking for the file to be transferred with the special character then declare it wil the char field...and send it..
    or the special charactera are coming unnecessary use the command ............replace all occurances  to avoid this..

  • Error while uploading a PAR file

    Hi All,
    I'm having an error when i try to upload a PAR file from Portal>Java Development>Development
    The strange is that i am having the error in QA environment, in development environment i can upload it without any problem, and also it is not the first time that I upload a PAR to QA.
    I hope someone can help me, i really don't know what to do...
    Regards,
    Nicolás.-
    Here is the error:
    May 8, 2009 11:46:34 AM # Client_Thread_17     Fatal           Application upload failed: InvoiceTool.par
    com.sapportals.portal.prt.runtime.PortalException: archive: InvoiceTool.par
    at com.sapportals.portal.application.applicationrepository.ApplicationRepositoryService.putArchive(ApplicationRepositoryService.java:309)
    at com.sapportals.portal.prt.deployment.DeploymentManager._uploadArchive(DeploymentManager.java:700)
    at com.sapportals.portal.prt.deployment.DeploymentManager.uploadArchive(DeploymentManager.java:396)
    at com.sapportals.portal.prt.deployment.DeploymentManager.uploadApplication(DeploymentManager.java:285)
    at com.sap.ip.portal.admin.portalanywhere.ArchiveUploader.doUpload(ArchiveUploader.java:115)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.handleRequestEvent(AbstractPortalComponent.java:700)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.handleEvent(AbstractPortalComponent.java:412)
    at com.sapportals.portal.prt.pom.ComponentNode.handleEvent(ComponentNode.java:250)
    at com.sapportals.portal.prt.pom.PortalNode.fireEventOnNode(PortalNode.java:351)
    at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:628)
    at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:229)
    at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:555)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:415)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.inqmy.services.servlets_jsp.server.InvokerServlet.service(InvokerServlet.java:126)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:149)
    at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:833)
    at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:672)
    at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:314)
    at com.inqmy.services.httpserver.server.Response.handle(Response.java:173)
    at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:1288)
    at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)
    at com.inqmy.core.cluster.impl5.ParserRunner.run(ParserRunner.java:55)
    at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:148)
    Caused by: java.util.zip.ZipException: error in opening zip file
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.(ZipFile.java:121)
    at com.sapportals.portal.prt.deployment.ArchiveIntrospector.getDeploymentDescriptor(ArchiveIntrospector.java:54)
    at com.sapportals.portal.prt.deployment.DeploymentManager.getDeploymentDescriptor(DeploymentManager.java:942)
    at com.sapportals.portal.application.applicationrepository.ApplicationRepositoryService.putArchive(ApplicationRepositoryService.java:273)
    at com.sapportals.portal.prt.deployment.DeploymentManager._uploadArchive(DeploymentManager.java:700)
    at com.sapportals.portal.prt.deployment.DeploymentManager.uploadArchive(DeploymentManager.java:396)
    at com.sapportals.portal.prt.deployment.DeploymentManager.uploadApplication(DeploymentManager.java:285)
    at com.sap.ip.portal.admin.portalanywhere.ArchiveUploader.doUpload(ArchiveUploader.java:115)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.handleRequestEvent(AbstractPortalComponent.java:700)
    at com.sapportals.portal.prt.component.AbstractPortalComponent.handleEvent(AbstractPortalComponent.java:412)
    at com.sapportals.portal.prt.pom.ComponentNode.handleEvent(ComponentNode.java:250)
    at com.sapportals.portal.prt.pom.PortalNode.fireEventOnNode(PortalNode.java:351)
    at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:628)
    at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:229)
    at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:555)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:415)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.inqmy.services.servlets_jsp.server.InvokerServlet.service(InvokerServlet.java:126)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:149)
    at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:833)
    at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:672)
    at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:314)
    at com.inqmy.services.httpserver.server.Response.handle(Response.java:173)
    at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:1288)
    at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)
    at com.inqmy.core.cluster.impl5.ParserRunner.run(ParserRunner.java:55)
    at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:148)

    Hi Nicolas,
    In you development server,
    1. Create a new iview  (With new from PAR file option). The iView wizard gives you the option to choose the PAR file available on your development portal.
    2. Now create a Transport Package. Navigate to System Administration - Transport - Export.
    Navigate to your Transport Folder in PCD.
    Now Create a new Transport Package and add the iView to the package (iView created earlier from PAR file).
    3. Now go to Transport Package properties and Make sure, you are changing the property id prefix to * .
    This will include every object associated with the iView while manually exporting.
    4. Now click on the EXPORT button. This will export the required PAR file with. This in turn create an EPA file. save it to your desktop.
    5. Now in Quality server,
    Do the manual Import.
    Navigate to System Administration - Transport - Import.
    Browse the EPA file on your desktop and say IMPORT.
    This way, you will be able to get your PAR file as well as your required portal object (here the iView) in quality server.
    Hope this helps,
    Cheers!!!!!
    Biroj...
    Points for useful answer will be appreciated.
    Edited by: Biroj Patro on May 12, 2009 8:40 PM

Maybe you are looking for