전자정부표준프레임워크
xml연계중 개행, <br />이 사라지는 문제와 관련해서
yeon.Biju
2016. 12. 14. 16:23
//OutputStreamWriter 인 경우 개행문자를 제대로 못가져오는 것 같음.
wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(xml.toString());
wr.flush();
//리턴된 결과 값 읽기
String inputLine = null;
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "utf-8"));
while ((inputLine = in.readLine()) != null) {
resStr += inputLine;
}
상세페이지 화면에 개행문자가 들어가 있는데 위와 같이 했더니 xml을 외부에서 가져오면서 개행이 표시되지 않음.
dos = conn.getOutputStream();
String data = xml.toString();
byte[] b = data.getBytes("UTF-8");
dos.write(b,0,b.length);
dos.flush();
InputStream dis = conn.getInputStream();
byte[] bytes = new byte[1024];
baos = new ByteArrayOutputStream();
while(true){
int red = dis.read(bytes,0,bytes.length);
if(red<0)
break;
baos.write(bytes,0,red);
}
resStr =(baos.toString("UTF-8"));
누군가 프로그램을 위와 같이 변경을 해주셨는데.. 그랬더니 개행이 잘 표시됨