Asking for a Linux command line to
convert all files in current folder from UTF8 to ANSI, name unchanged.

Best Regards
Pei

Something similar to

for filename in *; do mv $filename `echo $filename | iconv  -f UTF8 -t ANSI`; done

Warning: the above will fail badly if the filenames contain spaces. Tweak accordingly. Test with echo instead of mv first.
PS: I am not sure that ANSI is a correct encoding name (isn't it ISO-8859-1?). In any case, see iconv --list output.

iconv seems not able to convert the file itself, which seems to tell, to keep the file name while converting is impossible....

It is always very good to have a backup in case something goes wrong, so

  1. make a new directory beside current one: mkdir ../something-or-other
  2. do the work with target ../something-or-other/$filename
  3. clean up: thisdir=$(pwd);cd ..; mv $thisdir $thisdir.back; mv something-or-other $thisdir; cd $thisdir

Beware that I did not test this code, so consider it pseudocode until proven otherwise.

The point is that now if your "ansi" encoded files aren't proper, the originals are still available in the .back directory, so you can easily undo the error, whatever it was.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.