从包含utf 8字符的属性文件中读取
从包含utf 8字符的属性文件中读取
我正在读取一个包含UTF-8字符集消息的属性文件。
问题
输出不是适当的格式。我使用InputStream。
属性文件如下:
username=LBSUSER
password=Lbs@123
url=http://localhost:1010/soapfe/services/MessagingWS
timeout=20000
message=Spanish character are = {á é í, ó,ú ,ü, ñ, ç, å, Á, É, Í, Ó, Ú, Ü, Ñ, Ç, ¿, °, 4° año = cuarto año, €, ¢, £, ¥}
我这样读取文件:
Properties props = new Properties();
props.load(new FileInputStream("uinsoaptest.properties"));
String username = props.getProperty("username", "test");
String password = props.getProperty("password", "12345");
String url = props.getProperty("url", "12345");
int timeout = Integer.parseInt(props.getProperty("timeout", "8000"));
String messagetext = props.getProperty("message");
System.out.println("This is soap msg : " + messagetext);
上述消息的输出如下:
您可以在以下行之后在控制台上看到消息:
{************************ SOAP MESSAGE TEST***********************}
如果我能得到正确读取该文件的任何帮助,我将不胜感激。我可以使用另一种方法读取该文件,但我希望尽量减少代码修改。