외국어 문자열 처리와 관련하여 질문이요

bloody의 이미지

첨부된 2개의 일본어 텍스트 파일(txt, html)을 보시면...
메모장에서 열어보면 특정 글짜가 깨져서 보이지만
html파일을 열어서 브라우저로 보면 안깨져 보입니다.

둘다 유니코드로 저장된(UTF-16)파일입니다.

왜 그런 차이를 보일까요?

File attachments: 
첨부파일 크기
Plain text icon jap.txt180바이트
HTML icon jap.html180바이트
klyx의 이미지

메모장이 utf-16을 지원하던가요? 제가 마지막으로 봤음땐 메모장이 지원하는 유니코드 인코딩은 utf-8이 유일했던거같네요.

bloody의 이미지

제가 사용하고 있는 win7 메모장 같은 경우
저장하기 누르면 엔코딩 옵션이

(1)ANSI
(2)유니코드
(3)유니코드 big endian
(4)UTF-8

이렇게 4가지를 지원하고 있고요
저기서 2번이 UTF-16 little endian이고
3번이 UTF-16 big endian인걸로 알고 있습니다.

세벌의 이미지

BOM 관련될수도...

익명 사용자의 이미지

유니코드 알고리즘 버그일 수도
특히 동아시아 인코딩은 버그 많아요

익명 사용자의 이미지

제 메모장(Windows 7)에서는 잘 보이는데요... 폰트 문제일 수도 있겠다 생각했습니다.

익명 사용자의 이미지

win7 어떤 걸 쓰시고 서비스팩 버전은요?

Prentice의 이미지

메모장에서는 font fall-back이 보장되지 않습니다. 현재 지정한 폰트에 해당 글자가 없으면, 글자가 제대로 안 보일 수도 있습니다.

(반대로, 가끔은 현재 폰트에 글자가 없더라도 다른 폰트에서 따와서 보여주는 케이스도 있긴 있으니 주의를 요합니다.)

cococo의 이미지

몰랐네요. -_-;;

dontdieych의 이미지

Unicode의 정의를 비트와 바이트로 인코딩 하는 방법중에 하나가 utf-16이라고 합니다. utf-8이 널리 쓰이구요.

마침 어제 이걸 읽었네요.

http://www.danielmiessler.com/study/encoding/#unicode

익명 사용자의 이미지

지금 다시 저 텍스트 파일을 메모장으로 열어보니
글자가 하나도 안깨져서 보이네요

왜 글자가 이번엔 또 하나도 안깨져 보일까요?
확실히 몇일전까지 깨져서 보였거든요
캡쳐화면도 있습니다.

댓글 달기

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