why "iconv" didn't convert myfile.csv to ASCII?


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
why "iconv" didn't convert myfile.csv to ASCII?

(it seems that this post is best put here, where shell programming people use "iconv" and "file" all the time. it was posted in the Linux Application and got no replies)

Dear there, I tried to use iconv to convert myfile.csv to ASCII and failed. Any ideas? myfile.csv contains only ASCII characters.

here is the log:
---------------------------------------------------------
sychen@sychen-laptop:/tmp$ file myfile.csv
myfile.csv: Bio-Rad .PIC Image File 13619 x 12339, 13618 images in file
sychen@sychen-laptop:/tmp$ iconv -f UTF-16 -t ASCII//IGNORE myfile.csv -omyfile_iconv.csv
iconv: illegal input sequence at position 16320
sychen@sychen-laptop:/tmp$ file myfile_iconv.csv
myfile_iconv.csv: empty
sychen@sychen-laptop:/tmp$ iconv -f UTF-8 -t ASCII//IGNORE myfile.csv -omyfile_iconv.csv
sychen@sychen-laptop:/tmp$ file myfile_iconv.csv
myfile_iconv.csv: Bio-Rad .PIC Image File 13619 x 12339, 13618 images in file
sychen@sychen-laptop:/tmp$ head -n 2 myfile.csv
353025450,AUD/JPY,2007-10-14 17:00:06,106.320000,106.390000,D
353025553,AUD/JPY,2007-10-14 17:01:23,106.330000,106.400000,D
sychen@sychen-laptop:/tmp$ head -n 2 myfile_iconv.csv
353025450,AUD/JPY,2007-10-14 17:00:06,106.320000,106.390000,D
353025553,AUD/JPY,2007-10-14 17:01:23,106.330000,106.400000,D
sychen@sychen-laptop:/tmp$ iconv --list
# 2  
You start out by saying that your file contains only ASCII characters. If so, then why are you trying to convert it from UTF16 to ASCII?
# 3  
by ASCII characters, I mean the ASCII range (U+0000 to U+007F)
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #310
Difficulty: Easy
The very first recorded computer bug was a spider found inside a Harvard Mark II computer.
True or False?

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Windows & DOS: Issues & Discussions

Convert "hex" foldername to "ascii"

So, I have a folder, containing subdirs like this: 52334d50 52365245 524b4450 524f3350 52533950 52535050 52555550 now I want to go ahead and rename all those folder: hex -> ascii (8 Replies)
Discussion started by: pasc
8 Replies

3. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

4. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Shell Programming and Scripting

How to convert "Nov 9 11:35:28 2009" to "200911091135"

Using AIX 5.3 and /user/bin/ksh. Anyone have a quick way to convert the string date Nov 9 11:35:28 2009 to 200911091135 I know I could create a table of months and find the month number by searching the list, but I was hoping there was some handy little known command to do this... (15 Replies)
Discussion started by: troym72
15 Replies

7. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

8. Programming

How to convert the "select" function into a "poll" function

i have a program using the select function but i want to convert it to poll... how can i do this? thanks in advance... :) (1 Reply)
Discussion started by: rbolante
1 Replies

9. UNIX for Dummies Questions & Answers

Convert "text" to "packed-decimal"?

Is there a way with HP-UX Release 10.20 (but going to HP-UX 11) to convert a regular "text" file to a packed data format (such as is created by a Cobol program)? (2 Replies)
Discussion started by: HuskyJim
2 Replies

Featured Tech Videos