혹시 네이버 오픈API 지도좌표변환 해보신분 계신가요?

groovecy의 이미지

좌표변환을 하려면 쿼리값으로 지역명이나 주소를 넣어줘야 하는데 한글검색을 하려합니다.
그런데 예문을 보면 한글로 들어가야하는데 아래처럼 글자가 깨져서 나옵니다.
이때문에 검색이 안되는것 같아요.. 소스는 아래 첨부할테니 제발 잘못된 부분좀 콕집어 주세요 ㅠㅠ
답글을 달아주시는 님들은 좀 짱인듯합니다.^^

 <a href="http://maps.naver.com/api/geocode.php?key=584cd***************8054ebdc260b&query=¿???" rel="nofollow">http://maps.naver.com/api/geocode.php?key=584cd***************8054ebdc260b&query=¿???</a> 

일단 넘겨주는 부분은 이렇게..

  clicked: function()
 {
     var queryInput = (document.getElementById('searchInput1')).value;
     var query = encodeURIComponent(queryInput)
     var params = "?key="+this.nmapKey+"&query="+query;
     var url = "proxy_nmap.jsp";
     xmlHttp.loadhttp(url+params, right.view);
 } 

프록시 프로그램입니다..

<?php@ page pageEncoding="euc-kr" ?>
<?php@ page import = "org.apache.commons.httpclient.HttpClient" ?>
<?php@ page import = "org.apache.commons.httpclient.methods.GetMethod" ?>
<?php@ page import = "org.apache.commons.httpclient.HttpStatus" ?>
<?php    request.setCharacterEncoding("utf-8");    
 
String url = "http://maps.naver.com/api/geocode.php";    
String queryString = request.getQueryString();    
HttpClient client = new HttpClient();    
GetMethod method = new GetMethod(url);     
method.setQueryString(queryString);     
 
try 
{           
    int statusCode = client.executeMethod(method);             
    out.clearBuffer();           
    response.reset();             
    response.setStatus(statusCode);             
    if (statusCode == HttpStatus.SC_OK)            
    {               
        String result = method.getResponseBodyAsString();               
        response.setContentType("text/xml; charset=utf-8");               
        out.println(result);           
    }       
} finally {           
    if (method != null) method.releaseConnection();      
    }?> 

네이버 오픈API에 보면 한글쿼리는 utf-8로 설정되어야 한다고 나와있는데.. 도대체 왜이럴까요..ㅠㅠ
혹시 브라우저의 인코딩설정과도 상관이 있을까요?
아니면 이클립스의 인코딩설정은요?? 아아~ 답답해 죽겠어요 ㅠㅠ

7339989b62a014c4ce6e31b3540bc7b5f06455024f22753f6235c935e8e5의 이미지

값은 EUC-KR로 받아오는데 보낼 때 UTF-8로 바꾸지 않고 보내서 그런 것 아닌가요?

groovecy의 이미지

혹시 페이지인코딩 설정과 관련이 있을까요? 이방법 저방법 다 해보다 보니 뭘 하고 안했는지조차 헷갈리네요..ㅠㅠ
그리고 encodeURIComponent가 UTF-8로 인코딩해주는 메소드 아닌가요??

It's up to you.

It's up to you.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.