Git Product home page Git Product logo

encoding's Introduction

encoding

encoding study

Build Setup

# Vue Cli 설치
npm install -g vue-cli

# npm 설치
npm install

# dev mode로 실행(localhost:8080)
npm run dev

Encoding

문자 인코딩(文字―, 영어: character encoding) 또는 줄여서 인코딩문자기호들의 집합을 컴퓨터에서 저장하거나 통신에 사용할 목적으로 부호화하는 방법을 가리킨다. 문자 인코딩을 통해 부호화되어, 복호화하면 본래의 문자나 기호를 뜻하게 되는 부호문자 코드(文字―, 영어: character code)라고 한다.

인코딩 종류

  • ASCII, UTF-8, UTF-16, EUC-KR
ASCII

ASCII 아스키 코드. American Standard Code for Information Interchange의 줄임말.

  • 7bit 문자 인코딩(!8bit)

  • 128개의 문자를 표현

  • carriage return?, line feed ?

    ASCII 시스템에서는 새줄 문자로 라인 피드(line feed, LF, '\n', 0x0A), 캐리지 리턴(carriage return, CR, '\r', 0x0D)이 주로 사용된다. 라인 피드는 프린터에서 종이가 한 줄씩 인쇄되며 나오는 것을 뜻한다. 캐리지 리턴은 프린터에서 실제 인쇄를 수행하는 장치가 한 줄의 끝에서 시작 위치로 돌아가는 것을 뜻한다.

    • windows os => \r\n
    • Unix => \n
Unicode

유니코드(Unicode)는 전 세계의 모든 문자를 컴퓨터에서 일관되게 표현하고 다룰 수 있도록 설계된 산업 표준이며, 유니코드 협회(Unicode Consortium)가 제정한다.

  • carriage return?, line feed?
    • LF, CR, LF+CR 등등 모든 문자를 줄바꿈으로 사용한다. Unicode 사용해야 함.ㅠ.ㅠ
UTF-8

UTF-8유니코드를 위한 가변 길이 문자 인코딩 방식

  • 하나의 문자를 나타내기 위해 1~4byte를 이용함
UTF-16

UTF-16(16-bit Unicode Transformation Format)은 유니코드 문자 인코딩 방식의 하나이다. 주로 사용되는 기본 다국어 평면 (BMP, Basic multilingual plane)에 속하는 문자들은 그대로 16비트 값으로 인코딩이 되고 그 이상의 문자는 특별히 정해진 방식으로 32비트로 인코딩이 된다.

  • 하나의 문자를 나타내기 위해 2 or 4 byte 를 이용한다.
EUC

확장 유닉스 코드(Extended Unix Code, EUC)란 한국어, 중국어, 일본어 문자 전산화에 주로 사용되는 8비트 문자 인코딩 방식이다.

  • EUC-KR
    • 한글 완성형 인코딩 방식
    • 다국어 버전에 제한적이라 현재는 거의 사용되지 않음 Unicode로 대체되는 중.

SBCS, MBCS, WBCS

  • SBCS 하나의 문자를 1byte로 표현(ASCII)
  • MBCS 하나의 문자를 다양한 바이트로 표현(EUC, Unicode 등등)
  • WBCS 하나의 문자를 2byte로 표현(Windows의 UNICODE)

문자열 길이를 어떻게 계산하나?

  • 예전엔 문자열 길이가 byte 길이의 -1이다.(null 문자 때문에)
  • Windows Unicode에서는 length(string) / sizeof(byte) 로 처리했음..ㅠ.ㅠ
  • 지금은???????

BOM

바이트 순서 표시(Byte Order Mark, BOM)는 유니코드 문자

  • 텍스트 스트림이 저장되는 바이트 순서 또는 엔디언
  • 텍스트 스트림이 유니코드라는 사실(높은 수준의 신뢰를 위함)
  • 여러 유니코드 인코딩 중 텍스트 스트림이 인코딩된 것
인코딩별 BOM
  • UTF-8: 0xEF, 0xBB, 0xBF
  • UTF-16: U+FEFF
  • UTF-32: UTF-16과 동일

Big Endian, Little Endian

엔디언은 보통 큰 단위가 앞에 나오는 빅 엔디언(Big-endian)과 작은 단위가 앞에 나오는 리틀 엔디언(Little-endian)으로 나눌 수 있다.

종류 0x1234 0x12345678
빅 엔디언 '12' '34' '12' '34' '56' '78'
리틀 엔디언 '34' '12' '78' '56' '34' '12'
  • 네트워크는 Big Endian, 윈도우는 Little Endian 네트워크 통신은 어떻게??

###csv 다운로드 한글 왜 깨지나?

  • 자바 프로그램은 UTF-8 로 저장.
  • CSV파일에는 유니코드를 나타내는 정보가 들어가 있지 않음
  • Windows 는 기본 언어 셋인 EUC-KR로 로드

encoding's People

Contributors

kkum04 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.