昨天写了个程序,用来做数据转发的,需要从txt文件里读数据,
FileInputStream fis = new FileInputStream(path); InputStreamReader isr = new InputStreamReader(fis,"UTF-8");
对文本进行解析之后使用socket发送
byte[] bs = sendStr.toString().getBytes("UTF-8"); os.println(new String(bs,"UTF-8")); os.flush(); System.out.println(new String(bs,"UTF-8"))
在myeclipse下运行,对方收到的数据进行解析,一切正常,使用javac解析也没有问题,也使用-encoding UTF-8设置了编码格式,在本地打印的中文正常,对方接收后显示中文乱码,想请教一下各位,有遇到过同样问题的吗?