html 파일 중간에 문자셋을 전환할 수 있을까요?

체스맨의 이미지

아니면, 아래 문제를 해결할 다른 방법이 있는지 알고 싶습니다.

구글 검색을 조금 편하게 이용하려고 검색 입력 부분만 떼어왔습니다.

<form target=_gsrch action=http://www.google.com/search name=f>
<p align=right>
<a target=_blank href="http://www.google.com">Google</a> |
<a target=_blank href=http://www.google.com/advanced_search?hl=ko>고급검색</a> |
<input type=hidden name=hl value=ko>
<input id=all type=radio name=lr value="" checked>전체
<input id=il type=radio name=lr value=lang_ko>한글
<input maxlength=2048 name=q value="" title="Google">
<input type=submit name=btnG value="검색">
</p>
</form>

그런데, 특정한 한글 문자열을 입력하고 엔터를 치면 (반드시 검색 버튼을 누르지 말고, 엔터를 쳐야 합니다.) 그 문자열이 제대로 전송되지 않습니다. 제가 테스트한 문자열은 "체커" 입니다.

"체커"라 했을 때 서버측에 전달되는 입력값은

lr=&q=%C3%BC%C4%BF

입니다.

한편 검색 버튼을 누르면 다음과 같은 입력값이 전달됩니다.

lr=&q=%C3%BC%C4%BF&btnG=%B0%CB%BB%F6

이 경우는 "체커"라고 잘 전달 됩니다. 그런데 버튼 레이블을 "체커"라고 바꾸면 역시 잘 전달되지 않습니다. 잘 모르지만 아마도 구글측에서 문자셋을 자동으로 감지하는 게 아닌가 예상해봤습니다.

이에 착안해서 폼에 다음처럼 불필요한 입력을 하나 더 추가했습니다.

<input type=hidden name=trash value="ㄱ">

다음과 같이 전달되고, 꽁수이긴 하지만 일단 잘 작동합니다.

trash=%A4%A1&hl=ko&lr=&q=%C3%BC%C4%BF

문제는 구글이 UTF-8 문자셋을 쓰고 있다는 점입니다.

<meta http-equiv="content-type" content="text/html; charset=UTF-8">

하지만, 다른 국내 검색 엔진 입력 폼도 만들어두려고 하고 있어서, 전체 페이지에 UTF-8 을 적용할 수는 없습니다. 그래서 중간에 UTF-8 로 전환했다가 EUC-KR 로 다시 복구하는 방법이 없는지 궁금합니다.

또는 위와 같은 문제를 해결할 적절한 방법이 있을까요...? 간단한 문제인데 제가 html 을 잘 몰라서 장황하게 늘어놓았는지 모르겠네요.

송효진의 이미지

http://www.google.co.kr/intl/ko/searchcode.html
코드창 밑에 회색글 참조하세요.

emerge money

체스맨의 이미지

구글 쪽에서 지원해 주는 게 있었군요. ^^

괜한 삽질을 좀 했네요.

Coral Library Project : http://coral.kldp.net
Orion Project : http://home.megapass.net/~heesc22/

Orion Project : http://orionids.org

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.