Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Character encoding shell命令iconv不';I don’我不会说出所要求的字符集_Character Encoding_Iconv - Fatal编程技术网

Character encoding shell命令iconv不';I don’我不会说出所要求的字符集

Character encoding shell命令iconv不';I don’我不会说出所要求的字符集,character-encoding,iconv,Character Encoding,Iconv,我有一个字符集US-ASCII的文件,想用UTF-8编码 > file -i from.php from.php: text/x-php; charset=us-ascii 我键入以下命令: > sudo -u www-data iconv -f US-ASCII -t UTF8 from.php > to.php 创建了to.php文件,但使用了错误的字符集 > file -i to.php to.php: text/x-php; charset=us-ascii

我有一个字符集US-ASCII的文件,想用UTF-8编码

> file -i from.php
from.php: text/x-php; charset=us-ascii
我键入以下命令:

> sudo -u www-data iconv -f US-ASCII -t UTF8 from.php > to.php
创建了to.php文件,但使用了错误的字符集

> file -i to.php
to.php: text/x-php; charset=us-ascii
我检查了字符集的iconv列表,US-ASCII和UTF8似乎写得很好

此命令无法更好地工作:

sudo -u www-data iconv -f US-ASCII -t UTF8 -o to.php from.php

我想我找到了解决办法

文件保留为us ascii格式,只是因为它不包含任何非ascii字符,如重音字母

我在文件中添加了一个重音字母,然后重新键入命令:

> file -i to.php
to.php: text/x-php; charset=utf-8
是啊

希望它能帮助别人