I/O Operations
Whenever text is being read from / written to a file, the encoding should be specified. (Preferably as UTF-8 but need to keep in mind the OS / Language / Locale)
try { FileOutputStream fos = new FileOutputStream("test.txt"); Writer out = new OutputStreamWriter(fos, "UTF-8"); out.write(strInputString); out.close(); } catch (IOException e) { e.printStackTrace(); } }
No comments:
Post a Comment