yearntolearn
yearntolearn

Reputation: 1074

Converting encoding from unknown-8bit to us-ascii not supported

I am trying to convert from unknown-8bit to us-ascii by using iconv. I have $ iconv -f unknown-8bit -t us-ascii file.txt > file1.txt

It shows an error message.

iconv: conversion from `unknown-8bit' is not supported
Try `iconv --help' or `iconv --usage' for more information.

Is there an alternative to conduct the conversion? Thank you!!

Upvotes: 8

Views: 10016

Answers (2)

bcag2
bcag2

Reputation: 2439

with accents, you can set it in vim as mentioned in this post: Set encoding and fileencoding to utf-8 in Vim

In my case, I have issue on '…', '−' and '-', I open the file under vim, correct issues and run in vim

:set fileencoding=utf-8

then save it and my file is utf-8 encoded!

Upvotes: 1

Thomas Dickey
Thomas Dickey

Reputation: 54515

You could use cat -v, e.g.,

cat -v file.txt > file1.txt

On most platforms, that will give an ASCII file.

Upvotes: 11

Related Questions