问题描述
在SSH(腻子)我使用一个命令来替换一个文件,该文件是EN $ C $光盘UTF-8
In SSH (Putty) I'm using a command to replace some text in a file which is encoded in UTF-8
例如
CD〜/的public_html /应用/配置; SED -iS / ADDRESS_SSH / L'住址àETE correctementintégréé/ G'param.php;
在文件中的所有正常,但在浏览器中显示时的口音很奇怪
当verifing文件param.php我发现它的编码方式是从 UTF-8
更改为欧洲DE L'Ouest的
In the file all is OK but when displaying in the browser the accents are strangeWhen verifing the file param.php I found that it's encoding was changing from UTF-8
to Europe de L'Ouest
有关.xml文件相同的问题太多
Same problem for .xml file too
任何帮助使用sed不改变编码或者添加一个其它SSH线为UTF-8新rencoding的PHP和XML文件?
Any help to use sed without changing the encoding or maybe to add an other ssh line for rencoding the php and xml files newly in UTF-8 ?
最好的问候,并感谢您
推荐答案
您必须确保已发行 SED
命令 UTF-8
连接codeD。
You have to ensure that the issued sed
command is UTF-8
encoded.
您可以通过以下两种方式之一进行:
You can do this in one of two ways:
-
写sed命令到一个文件,确保文件是UTF-8,并执行它作为一个脚本:
Write the sed command to a file, ensure the file is UTF-8, and execute it as a script:
文件yourfile
应该说 UTF-8的Uni code文本
。
您可以再运行庆典yourfile
。
另外,换用其他终端和shell设置为UTF-8
Alternatively, change your terminal and shell settings to UTF-8
的printf A | WC -c
必须说2,而不是1
printf à | wc -c
must say 2, not 1.
区域设置
应列出UTF-8或 LC_CTYPE
行UTF8。
locale
should list "UTF-8" or "utf8" in the LC_CTYPE
line.
您可以再直从终端提示符下运行sed命令。
You can then run the sed command straight from the terminal prompt.
这篇关于SED和UTF-8编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!