<div>안녕하세요 .. 현재 이클립스 안드로이드 환경에서 json 을 읽으려다가 계속 좌절중입니다 ..ㅠㅠ</div> <div>이전에 json을 읽어서 사용해본적이 있기 때문에 쉬울꺼라고 생각했는데 ..</div> <div>unicode 형태로된 값을 한글로 변환하는 것을 정말 모르겠습니다..</div> <div> </div> <div>일단 json은 <a target="_blank" href="http://data.suwon.go.kr/api/action/datastore_search.jsp?resource_id=b06b6552-6ce5-4870-a071-1d2a6c1a1813&limit=1" target="_blank">http://data.suwon.go.kr/api/action/datastore_search.jsp?resource_id=b06b6552-6ce5-4870-a071-1d2a6c1a1813&limit=1</a> 을 통해서 읽었습니다. 형태는 아래와 같습니다.</div> <div> </div><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"></pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">입니다 .. 영어부분은 잘 출력되나 한글부분이 unicode 형태로 나와있습니다.</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">이거를 제가 자바코드로 읽을 때는 </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">HttpClient httpclient = new DefaultHttpClient();</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> HttpGet httpget = null;</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">httpget = new HttpGet("<a target="_blank" href="http://data.suwon.go.kr/api/action/datastore_search.jsp?resource_id=b06b6552-6ce5-4870-a071-1d2a6c1a1813" target="_blank">http://data.suwon.go.kr/api/action/datastore_search.jsp?resource_id=b06b6552-6ce5-4870-a071-1d2a6c1a1813</a><u></u>");</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">HttpResponse response=null;</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> response = httpclient.execute(httpget);</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> HttpEntity entity = response.getEntity();<br> </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> if (entity != null)<br> {<br> <br> InputStream instream = entity.getContent(); <br> String result= convertStreamToString(instream);</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> }</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">이런 형태로 읽습니다..</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">그리고 convertStreamToString 함수의 내용은</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">private static String convertStreamToString(InputStream is) throws UnsupportedEncodingException {<br> <br> BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));//"EUC-KR" or "UTF-8"<br> <br> StringBuilder sb = new StringBuilder();</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> String line = null;<br> try {<br> while ((line = reader.readLine()) != null) {<br> sb.append(line + "\n");<br> }<br> } catch (IOException e) {<br> e.printStackTrace();<br> } finally {<br> try {<br> is.close();<br> } catch (IOException e) {<br> e.printStackTrace();<br> }<br> }<br> return sb.toString();<br> }</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">입니다 ㅠㅠㅠ</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">지금 문제는 </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">한글 부분이 유니코드 형태로 출력됩니다..</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">제가 원하는건 유니코드 형태를 한글로 바꾸고싶은건데 방법을 전혀모르겠습니다 </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">이틀째 삽질중입니다ㅠㅠ 도움을 주시면 감사하겠습니다</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;">감사합니다 ㅠㅠ</pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> </pre><pre style="color:rgb(0,0,0);text-transform:none;line-height:normal;text-indent:0px;letter-spacing:normal;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap;"> </pre>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.