我是新来的augeas,我得到了很多错误,如:
Could not evaluate: invalid byte sequence in UTF-8
<?xml version="1.0" encoding="ISO-8859-1"?>
但在镜头的源代码,我不明白,这是考虑到,但我可能是错的感觉,我不明白的镜头格式很多: https : //github.com/hercules-team/augeas/blob /master/lenses/xml.aug
或者Java-Properties-File总是被视为ISO-8859-1 ,并且镜头源代码中没有任何编码的痕迹: https : //github.com/hercules-team/augeas/blob/master/镜头/ properties.aug
我的第一个问题是:augeas推断正确的编码为XML和属性 – 文件?
我的第二个问题是:有没有办法告诉augeas使用哪种编码?
假设系统默认的编码是UTF-8:
vi testUTF.properties # Käse abc=test # tèté persona=niño
一切都很好:
puppet-test:~ # augtool --noautoload augtool> set /augeas/load/Properties/lens Properties.lns augtool> set /augeas/load/Properties/incl "/root/testUTF.properties" augtool> load augtool> print /augeas/files/root/testUTF.properties /augeas/files/root/testUTF.properties /augeas/files/root/testUTF.properties/path = "/files/root/testUTF.properties" /augeas/files/root/testUTF.properties/mtime = "1491478421" /augeas/files/root/testUTF.properties/lens = "Properties.lns" /augeas/files/root/testUTF.properties/lens/info = "/usr/share/augeas/lenses/dist/properties.aug:25.20-.53:" augtool> print /files/root/testUTF.properties /files/root/testUTF.properties /files/root/testUTF.properties/#comment[1] = "K\303\244se" /files/root/testUTF.properties/abc = "test" /files/root/testUTF.properties/#comment[2] = "t\303\250t\303\251" /files/root/testUTF.properties/persona = "ni\303\261o"
现在将文件转换为iso-8859-1:
iconv --from-code UTF-8 --to-code ISO-8859-1 -o testIso.properties testUTF.properties
和
puppet-test:~ # augtool --noautoload augtool> set /augeas/load/Properties/lens Properties.lns augtool> set /augeas/load/Properties/incl "/root/testIso.properties" augtool> load augtool> print /augeas/files/root/testIso.properties /augeas/files/root/testIso.properties /augeas/files/root/testIso.properties/path = "/files/root/testIso.properties" /augeas/files/root/testIso.properties/mtime = "1491478512" /augeas/files/root/testIso.properties/lens = "Properties.lns" /augeas/files/root/testIso.properties/lens/info = "/usr/share/augeas/lenses/dist/properties.aug:25.20-.53:" augtool> print /files/root/testIso.properties /files/root/testIso.properties /files/root/testIso.properties/#comment[1] = "K\344se" /files/root/testIso.properties/abc = "test" /files/root/testIso.properties/#comment[2] = "t\350t\351" /files/root/testIso.properties/persona = "ni\361o"
现在一切都还好, 不应该 …
所以,那肯定不是一个呃问题,而是一个傀儡问题
重申我的问题:
有什么办法告诉Puppet的augeas资源使用哪种编码?
提前谢谢了