java读写文件的中文乱码问题
2009-11-19 21:02:38 来源:WEB开发网核心提示:1、java读取文件,避免中文乱码,java读写文件的中文乱码问题,/*** 读取文件内容* * @param filePathAndName*String 如 c:\\1.txt 绝对路径* @return boolean*/public static String readFile(String filePathA
1、java读取文件,避免中文乱码。
/**
* 读取文件内容
*
* @param filePathAndName
* String 如 c:\\1.txt 绝对路径
* @return boolean
*/
public static String readFile(String filePathAndName) {
String fileContent = "";
try {
File f = new File(filePathAndName);
if(f.isFile()&&f.exists()){
InputStreamReader read = new InputStreamReader(new FileInputStream(f),"UTF-8");
BufferedRead
/**
* 读取文件内容
*
* @param filePathAndName
* String 如 c:\\1.txt 绝对路径
* @return boolean
*/
public static String readFile(String filePathAndName) {
String fileContent = "";
try {
File f = new File(filePathAndName);
if(f.isFile()&&f.exists()){
InputStreamReader read = new InputStreamReader(new FileInputStream(f),"UTF-8");
BufferedRead
更多精彩
赞助商链接