我从客户那里获得了腐败的财产档案。 该档案经申请修改,以更新版本编号。 守则使用apachecommsposition。 在我测试后,图书馆似乎总是以正直-8859-1格式书写档案。
法典简化如下。 下面的法典写坏案的可能性如何?
import org.apache.commons.configuration.ConfigurationException;
import org.apache.commons.configuration.PropertiesConfiguration;
import java.io.FileWriter;
import java.io.IOException;
public class TestConfig {
public void editVersionInfo() throws ConfigurationException, IOException {
String filename = "C:\temp\VersionProperties\Version.properties";
PropertiesConfiguration config = new PropertiesConfiguration(filename);
config.setProperty("application.version", "2011");
config.save(new FileWriter(filename));
}
public static void main(String[] args) throws IOException, ConfigurationException {
TestConfig tc = new TestConfig();
tc.editVersionInfo();
}
}
就在案件上,坏档案如下。 它不喜欢任何编码。 档案最初是带有钥匙和价值的普通财产档案,全部是英文(acii chars)。
F????Co?aR??m??E?3#?? = hu00BD5ju00B3u00E0u0096u001Du0081feu00BEou00A3u0001u00FEu00A4u00DEu0000u00FBi"u009C{u00FCu00D9u00E2?cu00F6u00FF%Bu00A47u00195u001EXvu0097/u00D7xu0099u000Eu00A2gIXu0014u0097]ku00882u0003u0014u0097u00BCu00C3u00AEu00B4u001Eu00B3Ru00E4u00DE&u0000u0016u009B"7u0085 "u00DCT*v u0092u0007u0091Au00BDu00ACl6~u0097u00C0u00B1u00D1u00EBu00FFu00A8u00F3u0001 u00BFu0006u001Fu009Cfku009Fu00C2u00D9L^_u0004J4u00AFu00D8u00DAWu00C4u00CDju00E3u0095u00D1+u00CE?u0004>Z]u00D7u000Bu0098u0016u0095u00ACu00F7u00E7u009ATFu0019f)u00A3u00A9u00DCu00ADu00ACtq5u0085u008E-u00A3oHu0000u00C2u0092u00B5u00F2u008AGu008F&u00F5u0017Hu0003!u0083u00B4u008AV=u00E0u00EDju00F0u00D0Ju00DBu00CCu00F2Ou00CEu00BEu00F0*4u0006y~u00C3u00B7"u000Bu00E4u00C0$>u00F3u00F2~u00CEu0097#u00BAcu00EC@u00B4u00ADu009Au00BAXfFu0083]u00C2u00D4u00ABu00F3u009DQu0092u00854zu0097u00FDG u0095u00E3}tyu0082Iu00C3`u009E ??
Edit: The customer environment is japanese. How ever the application is always run with
-Dfile.encoding=UTF8