How to convert the file from ASCII to UTF-8?

I am trying to transcode a bunch of files from ASCII to UTF-8.

For this, I tried to use iconv:

iconv -f US-ASCII -t UTF-8 infile > outfile

-f ENCODING input coding

-t ENCODING output encoding

However, this file is not converted to UTF-8. This is a .dat file.

Before posting this, I searched on Google and found information such as:

ASCII is a subset of UTF-8, so all ASCII files already have UTF-8 encoding. The bytes in the ASCII file and the bytes that result from "encoding it in UTF-8" will be exactly the same bytes. There is no difference between the two.

Force encoding from US-ASCII to UTF-8 (iconv)

Best way to convert text files between character sets?

However, the above links did not help.

, ASCII, UTF-8, UTF-8 - , , , UTF-8. UTF-8.

, .

+1
1

, , , ASCII UTF-8, ASCII UTF-8.

, ASCII, , , " UTF-8", , , ASCII , UTF-8.

, , :

iconv: Windows ANSI UTF-8

, "" ( ), - , UTF-8, , ASCII, , ANSI ISO-8859-1.

, , , ""

Tims-MacBook-Pro:~ tjohns$ echo 'Stuff' > deleteme
Tims-MacBook-Pro:~ tjohns$ cat deleteme
Stuff
Tims-MacBook-Pro:~ tjohns$ file -I deleteme
deleteme: text/plain; charset=us-ascii
Tims-MacBook-Pro:~ tjohns$ echo -ne '\xEF\xBB\xBF' > deleteme
Tims-MacBook-Pro:~ tjohns$ echo 'Stuff' >> deleteme
Tims-MacBook-Pro:~ tjohns$ cat deleteme
Stuff
Tims-MacBook-Pro:~ tjohns$ file -I deleteme
deleteme: text/plain; charset=utf-8
+11

Source: https://habr.com/ru/post/1681124/


All Articles