Convert ASCII CSV file

i have a program which able to digest a CSV file into the DB (SQLanywhere), however my original CSV file is a ASCII format, where the program is only accept UTF-8. is there any method can convert the CSV file from ASCII to UTF-8 automatically?
Q1.
is it using the following for conversion?
byte[] bytes = test.getBytes("IS0-8859-1");
String encoded = new String(bytes,"UTF-8");
Q2.
is there any method can eliminate the text qualifier (")?
e.g. "0028634063","BETTY CROCKER'S KIDS COOK!-HB"," 121.50" become
0028634063,BETTY CROCKER'S KIDS COOK!-HB,121.50
Thanks a lot!

Q1.
is it using the following for conversion?
byte[] bytes = test.getBytes("IS0-8859-1");
String encoded = new String(bytes,"UTF-8");I'm pretty sure the above is not going to do what you expect. You convert some test string to bytes in the 8859-1 encoding. Now bytes has 8859-1 values. Then, you try to create "encoded" with that same "bytes" array...but now you seem to think it suddenly has UTF-8 values. It doesn't...it still has the 8859-1 values you just created. Using "bytes" as a UTF-8 array doesn't seem quite right.
John O'Conner

Similar Messages

  • How to convert a CSV file to HTML?

    Hi I'm wondering how we can convert a CSV file to a HTML file?
    Moreover what is the best way to count the number of lines in a given file?
    Is using readlines() the best way?
    Thanks,
    Kishore

    Kishorei20 wrote:
    Hi I'm wondering how we can convert a CSV file to a HTML file? easy way: put <html> in the front and </html> at the end and yu've got an html file
    but I think what ur looking for is how to build table
    start with <table><tr><td>
    every comma becomes </td><td>
    every newline become </td></tr></tr><td>
    Moreover what is the best way to count the number of lines in a given file?
    Is using readlines() the best way?
    Thanks,
    Kishore

  • Hi, how do i convert a .csv file to a .SIF file on mac book?

    Hi, i am unable to convert a .csv file to a .SIF file on my mac. does anyone know how please?

    Open it in Preview, Duplicate and Save as JPEG.  It's advisable to add the extension ".jpeg" to the filename when you save.

  • How to convert a csv file into excel report?

    Hello,
    I have a csv file, can any body help me how to convert it into an excel report.
    thanks in advance
    vakvarma

    Search this board for "read CVS" and "write Excel". both are very common questions, you should be able to find answers very quickly.
    Hints: String.split(), Apache POI

  • SQLLDR to load data in Excel file without converting to CSV file

    Hello Guys,
    We are getting data in excel sheet and we need to insert data into oracle table. Is it possible to do with SQLLDR command that too without converting the excel file to csv format.
    If its possible can any one share a pseudo code to do that.
    Your help is well appreciated.
    Thanks in advance

    Is it possible to do with SQLLDR command that too without converting the excel file to csv format
    SQL*Loader does not know how to process the microsoft proprietary binary format of Excel files.  If you really want to use SQL*Loader then the data will have to be exported from Excel to a format that SQL*Loader can use, such as CSV... otherwise, don't use SQL*Loader (see the FAQ I posted already)

  • How to SAP data convert into csv file.

    hi,
    i have a one internal table , and i want to extract SAP data into csv file with filed separator ','(comma).
    Thanks

    you can use this coding for slove yours issue
    tables: vbak.
    Use type pool:
    TYPE-POOLS: TRUXS.
    parameters: p_erdat like vbak-erdat.
    DATA: COM TYPE C . For comma SEPERATOR
    data: begin of itab occurs 0,
          vbeln like vbak-vbeln,
          erdat like vbak-erdat,
          end of itab.
    DATA: ITAB1 TYPE TRUXS_T_TEXT_DATA OCCURS 0 .
    COM = ','.
    select vbeln
           erdat
           into table itab
           from vbak
           where erdat = p_erdat.
    FM:
    CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
    EXPORTING
       I_FIELD_SEPERATOR          = COM
      I_LINE_HEADER              =
      I_FILENAME                 =
      I_APPL_KEEP                = ' '
      TABLES
        I_TAB_SAP_DATA             =  ITAB
    CHANGING
       I_TAB_CONVERTED_DATA       = ITAB1
    EXCEPTIONS
      CONVERSION_FAILED          = 1
      OTHERS                     = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    FM:
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                  =
        FILENAME                      = 'C:\TEST.CSV'
       FILETYPE                       = 'ASC'

  • Import Export of contacts via ASCII CSV file

    Hi all. I have a 9300 Curve. This is my phone. I had a workphone which was a 9900 Bold. I backed up the Bold when i left the job. I want to import the contacts from the Bold back up into the Curve. If i export the Curve contacts to a csv file. Then import the bold contacts from restoring just the contacts list.... so far ok, bold contacts in, curve contacts overwritten but they are in a file as csv. I then try to one way sync the curve contacts back in.....the csv file has removed all the zeros from the start of every number. If you "edit" the csv in notepad they are there but when you look via excel...they are not. If i sync back in....the zero's are gone. I do not want to sync with windows live or anything like that as it will import a whole heap of **bleep** i dont want as well.
    Any clues?
    Thanks

    *Feedback*
    "Use the form below to send us your comments. We read all feedback carefully, but please note that we cannot respond to the comments you submit."
    http://www.apple.com/feedback/ipad.html
    Airstash
                                            Compatibility                               
                                            Wireless operation:                               
                                                    Web browser WiFi b/g capable device                                       
                                                    Optimized experience for iPhone, iPod touch, and iPad via HTML5                                       
                                                    No internet connection required                                       
                                            USB operation:                               
                                                    Compatible with most operating systems that support USB Mass Storage Class (thumb drives)                                       
                                                    Firmware update via file drag and drop                                       
    http://www.airstash.com/

  • Problem in converting table data into CSV file

    Hi All,
    In my Process i need to convert my error table data into csv file,my data is converted as csv file by using OdisqlUnload function,but the column headers are not converted,i use another procedure for converting column headers but iam getting below error ...
    com.sunopsis.sql.SnpsMissingParametersException: Missing parameter string.find, string.find
    SQL: import string import java.sql as sql import java.lang as lang import re sourceConnection = odiRef.getJDBCConnection("SRC") output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+') myStmt = sourceConnection.createStatement() my_query = "select * FROM E$_LOCAL_F0911Z1" my_query=my_query.upper() if string.find(my_query, '*') > 0: myRs = myStmt.executeQuery(my_query) md=myRs.getMetaData() collect=[] i=1 while (i <= md.getColumnCount()): collect.append(md.getColumnName(i)) i += 1 header=','.join(map(string.strip, collect)) elif string.find(my_query,'||') > 0: header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',') else: header = my_query[7:string.find(my_query, 'FROM')] print header old=output_write.read() output_write.seek(0) output_write.write (header+'\n'+old) sourceConnection.close() output_write.close()
    And i used below code for converting.......
    import string
    import java.sql as sql
    import java.lang as lang
    import re
    sourceConnection = odiRef.getJDBCConnection("SRC")
    output_write=open('C:/Oracle/Middleware/Oracle_ODI2/oracledi/pro/PRO.txt','r+')
    myStmt = sourceConnection.createStatement()
    my_query = "select FROM E$_COMPANY"*
    *my_query=my_query.upper()*
    *if string.find(my_query, '*') > 0:*
    *myRs = myStmt.executeQuery(my_query)*
    *md=myRs.getMetaData()*
    *collect=[]*
    *i=1*
    *while (i <= md.getColumnCount()):*
    *collect.append(md.getColumnName(i))*
    *i += 1*
    *header=','.join(map(string.strip, collect))*
    *elif string.find(my_query,'||') > 0:*
    *header = my_query[7:string.find(my_query, 'FROM')].replace("||','||",',')*
    *else:*
    *header = my_query[7:string.find(my_query, 'FROM')]*
    *print header*
    *old=output_write.read()*
    *output_write.seek(0)*
    *output_write.write (header+'\n'+old)*
    *sourceConnection.close()*
    *output_write.close()*
    Any one can you help regarding this
    Edited by: 30021986 on Oct 1, 2012 6:04 PM

    This may not be an option for you but in pinch you may want to consider outputing your data to an MS Spreadsheet, then saving it as a CSV. It's somewhat of a cumbersome process, but it will get you by for now.
    You will need to change your content type to application/vnd.ms-excel.
    <% response.setContentType("application/vnd.ms-excel"); %>

  • Program for converting fixed length file to csv

    Hello All,
    My requirement is to write a program which will read a file of fixed length separator (file where fields are separated by their length) from application server and convert to CSV file (fields separated by comma) .
    Please help me with code sample.
    regards
    Santosh

    Hi Santosh,
    SAP_CONVERT_TO_CSV_FORMAT
    Hope the above FM helps you.
    Very usefull thread
    reg:currency and quantity
    Have A Nice Day
    Chaitanya.

  • Converting csv files to signals

    I need to convert this csv file to an analog signal.  The timing and magnitude need to be exact

    duplicate post

  • Sender "Mail" adapter - CSV file attachment

    Hi there
    I'm looking for some help in configuring a sender mail adapter that receives ".csv" files. I did read some blogs that mention using the "PayloadSwapBean" module to read the mail attachment instead of the mail content. My problem is to now convert the ".csv" file into a message. Is there a module that I can use ( is it the "MessageTransfomBean" ) and how. Any help would be appreciated.
    Thanks
    Salil

    Hi Salil,
    If you want to send a mail with a body and attachments, the message sender HAS to provide an XI message with attachments. I doubt a CSV file does justice.
    As Renjith said you need to convert CSV to XmL.
    A short description about the Standard Modules:
    MessageTransformationBean is a standard module used to apply the XSLT mapping to the adapter module by using <i>Transform.class</i> ( This xslt mapping is done to create a mail package, Dont confuse with the actual mapping in your case this is NOT for converting csv to xml).
    Also this module can be used to change the name and type of payloads by using <i>Transform.contentType</i>, <i>Transform.contentDisposition</i>, <i>Transform.contentDescription</i>.
    PayloadSwapbean is a standard module for replacing payloads with other payloads (SWAP)
    If you want to give each attachment a certain name use Parameters, <i>swap.keyname</i> for name of the payload and <i>swap.keyvalue</i>.
    I Hope the use of standard modules is understood.

  • Read from .csv file at startup

    Hi, I am making my first app and I need to read data from a csv file into a list. I first created this functionality on a console application, but now when I try to use the same code it does not work.
    class FoodDataBase {
    private List<Food> foodDataBase = new List<Food>();
    private string locationOfCSVFile = "C:\\Egen Programmering\\LivsmedelsDatabas\\LivsmedelsDatabas\\LivsmedelsDatabas.csv";
    public FoodDataBase() {
    PopulateFoodDataBase();
    private bool PopulateFoodDataBase() {
    // connect reader to the CSV file
    var reader = new StreamReader(File.OpenRead(@locationOfCSVFile));
    if (reader == null) {
    return false;
    But I get an error message saying "The name 'File' does not exist in the current context". I have googled around a bit but can´t find an easy way to do it. Is there not any good way of doing this in WinRT? Should I convert my csv file to something
    else?

    Hi PontusL,
    As I can see from your code, you are trying to read a file from a forbidden place, see this for more information:
    File access and permissions.
    --James
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • CSV File attachment in Receiver Mail Adapter

    Hi Experts ,
                                   mine is a proxy to mail scenario  Information from proxy needs to be converted to CSV file and to be send across in the form of attachment to multiple recievers.
       I would request best suggestions from experts.
    Regards,
    Arnab .

    Hi,
    first approach is,
       1. in cilent proxy report to call  'GUI_UPLOAD' function module ,    in  exporting, filetype =  'txt', filename.
    second approach is,
       2. you can you message transformation bean in you mail receiver communication channel.
    http://help.sap.com/saphelp_nw04/helpdata/en/57/0b2c4142aef623e10000000a155106/frameset.htm
    you want to send multiple receivers ,
    3. In the Receiver Determination, you need to select " Extended" in the Type of Receeiver determination.
    http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3343.
    regards,
    ganesh.

  • How to handle a comma in a field in CSV file during FCC ?

    Hi,
    I am having a requirement where we have to convert a CSV file into XML using File Content Conversion . The issue is one of the field in the file is having a comma inside. So the XML parser is taking it as a field separator and throwing an error.
    The contents of the file are as follows:
    "02975859","New Key","9","Failed, rejected by RTI server"
    How to handle a comma inside field "Failed, rejected by RTI server".
    Any help would be appreciated.
    Regards
    Pravesh

    Hi ,
    You have to write an java mapping programm to perdromance this task , in a estandar way i think is not possible , because the fiel adapter have just one option for the delimiter character.
    Here's some code that could help you
    Supouse a file in this way:
    1,rahul,siemens,mumbai
    2,consultant,12032005
    1,viswanath,sisl,hyderabad
    2,systemeng,23052005
    package TXTMapping;
    import java.io.BufferedReader;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.util.Map;
    import com.sap.aii.mapping.api.StreamTransformation;
    public class TMapping implements StreamTransformation {
    private Map map;
    public void setParameter (Map param){
    map = param;
    public void execute (InputStream in, OutputStream out){
    try{
    out.write("<?xml version ='1.0' encoding='UTF-8'?>".getBytes());
    out.write("<ns0:Output_Data xmlns:ns0=\"urn:javamapping_test\">".getBytes());
    String line = null;
    BufferedReader bin = new BufferedReader(new InputStreamReader(in));
    StringBuffer buffer = new StringBuffer();
    while((line = bin.readLine())!= null){
    String Company = null;
    String Name = null;
    String Place = null;
    String Desgn = null;
    String Since = null;
    char[] str= new char[100];
    str = line.toCharArray();
    String[] Data = new String[10];
    int S1 = 0;
    int s2 = 2;
    for (int i=2; i<line.length(); i++)
    if (str<i>==',' && str[0]=='1')
    Data[S1]= line.substring(s2,i);
    S1=S1+1;
    s2 = i+1;
    if (i == line.length()-1 && str[0] == '1')
    Data[S1]= line.substring(s2,i+1);
    Name = Data[0];
    Company = Data[1];
    Place = Data[2];
    out.write ("<Data>".getBytes());
    out.write ("<Header>".getBytes());
    out.write (("<Name>"Name"</Name>").getBytes());
    out.write (("<Company>"Company"</Company>").getBytes());
    out.write (("<Place>"Place"</Place>").getBytes());
    out.write ("</Header>".getBytes());
    if (str<i>==',' && str[0]=='2')
    Data[S1]= line.substring(s2,i);
    S1=S1+1;
    s2 = i+1;
    if (i == line.length()-1 && str[0] == '2')
    Data[S1]= line.substring(s2,i+1);
    Desgn = Data[0];
    Since = Data[1];
    out.write ("<Item>".getBytes());
    out.write (("<Designation>"Desgn"</Designation>").getBytes());
    out.write (("<Since>"Since"</Since>").getBytes());
    out.write ("</Item>".getBytes());
    out.write ("</Data>".getBytes());
    out.write("</ns0:Output_Data>".getBytes());
    catch(Throwable t){
    t.printStackTrace();

  • Reading a csv file in Labview

    I need to be able to read a 2D csv file and pull the data out by rows for use in an I/O write. I am working with a Lakeshore 331 temperature controller and need to be able to write parameters from a csv file to the temp controller. There are three columns of data; Set temp, Stabilization time, and Tolerance. I need to be able to switch between using tolerance data and a time switch to change a boolean to true. That true boolean needs to be able to be able to light a "Temp Stabilized Flag" and run a loop to the next row of data points were the previous row of written data points will be replaced by the following row. Basically, when one row of desired parameters is achieved, the program reads the next row of parameters and uses them as the standard until those parameter points are achieved. This process will continue until the entire list is exhausted. I am unable to find a way to read the csv by rows. My initial thought was to use the "Read Text" function and convert the string to the three seperate data points but I was unable to make that work. I have attached an example csv file, a rough draft file of what I need in order to write the data to the 331(which is entirely unfinished but provides a basic idea of where I am coming from), and my full project in case it helps. Please help me find a way to pull each row of data points individually in the previously mentioned cycle.
    Thank  You,
    Matt  
    Attachments:
    csv rough draft.vi ‏25 KB
    Lakeshore 331 Project_Test.vi ‏52 KB
    Test331.csv ‏1 KB

    I suggest you look at using the subVI Spreadsheet String to Array from the palette to convert the csv file to an array of parameters then you can use a for loop to index through the data elements one row at a time.  You may need to use an index primitive or internal loop to process the data.
    If you check out the examples through the "Example Finder" you will most likely discover a good starting point for your problem.
    happy Codeing
    Wire Warrior
    Wire Warrior
    Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!

Maybe you are looking for

  • How to send a copy of a document via Gmail?

    Hello, After the update to iOS 8.1, I can see the option to send a copy of the document via email. In my case I was able to send the document via Yahoo mail app installed on the device. However, I cannot send through the GMail app installed. I am not

  • Is anyone else super mad about not having a cd port for the new iMac?

    I just bought this new iMac as an upgrade from my old '09 one. I thought this was to have a cd port but it doesn't! I'm super mad because i always used to burn my iMovies onto cds so I could watch them but now I can't. I guess I should've read the bo

  • Csv with double quotes

    Hello, I've had harsh time trying to figure out how to read a csv file with double quotes, I need to read a csv file in order to fill a spreadsheet. I attach a csv file example to show the sort of file I'm working on. Thank you Raymundo Cassani Solve

  • PIR consumption issue

    We have been having intermittent problems with our R/3 implementation (4.7C)for a long time. PIRs get consumed without explanation (i.e. no sales orders coming it to consume the forecast, which is expressed as PIRs). We suspect it might have somethin

  • Where is the photo bin in photoshop CC

    Where is the photo bin in photoshop CC