Six Stars

How to convert csv file into ascii format

Hi,

I have a requirement, given below.

I need to create a file (csv file) by fetching data from a DB and that csv file I need to send to another server. Client on other server requires this file in ASCII format.

Please help me.

By default Talend supports ISO and UTF-8 encoding.

1. How to convert this file into ASCII

2. If I convert this file into ASCII (some how), will each record of this will appear on next line automatically?

1 ACCEPTED SOLUTION

Accepted Solutions
Twelve Stars TRF
Twelve Stars

Re: How to convert csv file into ascii format

- field separator (,) OK

- line separator ( \r\n) Warning they said "Carriage return", not "Carriage return + Line feed" - the answer doesn't make sens, they should have said "Line feed" or "Carriage return + Line feed" (carriage return on old typewriters or printers represents the head movement to the left side of the machine, but not to the next line which is drived by line feed - doesn't make sens when speaking about files, right?)

- field enclosure (Not mentioned, hope it is not required) OK

- character encoding (They mentioned in ASCII) Go with UTF-8 or ask them


TRF
9 REPLIES
Twelve Stars TRF
Twelve Stars

Re: How to convert csv file into ascii format

Hi,

Can you please give us a sample data including the input and the expected outpout.


TRF
Six Stars

Re: How to convert csv file into ascii format

Hi TRF,

Below are the sample data,

name,tenure
Vibin Talend 1,1.0
Lijo Talend 1,1.0
Mash Talend 1,1.0
John Talend 1,1.0

 

It is nothing but fetch some records from a db to create a csv file. That need to send as it is, but it should be in ASCII format, because client needed in ASCII format.

Twelve Stars TRF
Twelve Stars

Re: How to convert csv file into ascii format

ASCII is not a file format, it's a character encoding format (like EBCDIC for example).

So, I understand your input but what is the expected output?


TRF
Six Stars

Re: How to convert csv file into ascii format

Hi TRF,

 

I have littile knowledge about encoding.

As per my understating (based on the requirement from client), the output file should be csv format and ascii encoded. Hope it will not change the data format while creating the file.

Could you please tell me how to achieve this

Six Stars

Re: How to convert csv file into ascii format

few more queries,

1. will utf-8 encode help in the above case?

2. will it help If I mention 'ASCII' in custom encoding?

 

please help me.

Twelve Stars TRF
Twelve Stars

Re: How to convert csv file into ascii format

ASCII encoding is the default (as soon as you're not working on a old mainframe).

Ask your client for the expected:

- field separator (; or other)

- line separator (\n or \r\n)

- field enclosure ("" or other or nothing) 

- character encoding (UTF-8, ISO-8859-1 or other)

 

The most standard (or simple) CSV files have the following settings:

- ";" for the field separator

- "\n" for the line separator

- nothing for the field enclosure 

- UTF-8 for the character encoding

 


TRF
Six Stars

Re: How to convert csv file into ascii format

Hi TRF,

 

Below is the reply from client,

 

The file will be in ASCII format consisting of variable length fields. A comma separates each field and there is no comma after the last field in a record. Records are terminated with a carriage return character.  The extract file will terminate with a carriage return character.

 

which summarized below,

 

- field separator (,)

- line separator ( \r\n)

- field enclosure (Not mentioned, hope it is not required) 

- character encoding (They mentioned in ASCII)

 

 

Twelve Stars TRF
Twelve Stars

Re: How to convert csv file into ascii format

- field separator (,) OK

- line separator ( \r\n) Warning they said "Carriage return", not "Carriage return + Line feed" - the answer doesn't make sens, they should have said "Line feed" or "Carriage return + Line feed" (carriage return on old typewriters or printers represents the head movement to the left side of the machine, but not to the next line which is drived by line feed - doesn't make sens when speaking about files, right?)

- field enclosure (Not mentioned, hope it is not required) OK

- character encoding (They mentioned in ASCII) Go with UTF-8 or ask them


TRF
Twelve Stars TRF
Twelve Stars

Re: How to convert csv file into ascii format

Hi,

Does this solve your case?

If so, mark the best solution.

Kudos also accepted.


TRF