안드로이드 개발 질문/답변
(글 수 45,052)
환경은 우분투 10.10이고 이클립스에서 실행시킵니다.
서버와 클라이언터(안드로이드 폰)가 통신은 되는데 이클립스 콘솔창에 한글이 깨져 나오네요..
이클립스 preference에서 utf-8로 설정은 해줬습니다.
혹시 리눅스 환경에서 설정해줄것이 더 있나 해서 질문드립니다.
그리고 jsp 웹 상에서는 값이 안나오는데.. 휴 뭐가 문젠지 모르겠네요.
부탁드립니다. (--)(__)
그리고 jsp 웹 상에서는 값이 안나오는데.. 휴 뭐가 문젠지 모르겠네요.
부탁드립니다. (--)(__)
jsp 부분.
<html>
<head>
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<?xml version="1.0" encoding="utf-8" ?>
<title></title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String Id = request.getParameter("id");
String Favorite_List = request.getParameter("value");
System.out.println("This is server test.");
System.out.println("Id =" + Id);
System.out.println("Value =" + Favorite_List);
%>
</body>
</html>
Android 부분
try{
String postURL = "~~~/TestApplicationServer/sessionTest.jsp";
String PostIDandFavoriteList = URLEncoder.encode("id", "UTF-8") +
"=" + URLEncoder.encode(myPhoneNumber, "UTF-8");
PostIDandFavoriteList += "&" + URLEncoder.encode("value", "UTF-8") +
"=" + URLEncoder.encode(FavoriteList.favorite_list.toString(), "UTF-8");
URL addressURL = new URL(postURL);
HttpURLConnection conn = (HttpURLConnection) addressURL.openConnection();
//conn.setRequestProperty("Content-Type", "application/x-www.form-urlencoded");
//conn.setRequestMethod("POST");
conn.setDoOutput(true);
OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
osw.write(PostIDandFavoriteList);
osw.flush();
BufferedReader read = new BufferedReader(new InputStreamReader(conn.getInputStream(), "cp949"));
String line;
if((line = read.readLine())!=null)
{
Toast t = Toast.makeText(
getApplicationContext(),
"Succese Registration " + "\n" + "\n"
+ line,
Toast.LENGTH_LONG);
t.show();
}
osw.close();
read.close();
}
catch(Exception e)
{
e.printStackTrace();
}



