Giter Club home page Giter Club logo

dart-cp949's Introduction

dart-cp949

CP949 을 Encode, Decode 해 주는 라이브러리입니다. (CP949 는 EUC-KR 의 상위집합이기 때문에, EUC-KR 도 다룰 수 있습니다.)

Pub Version

license Conventional Commits Commitizen friendly pr welcome

Installation

dependencies:
  cp949: ^1.0.0

Why?

Dart 는 non-unicode 인코딩/디코딩을 native 하게 지원하지 않습니다. 글을 쓰는 시점으로 CP949 지원하는 라이브러리는 이 프로젝트가 유일해 보입니다.

Usage

decode()

CP949 (EUC-KR) byte 배열을 (List<int>) 받아 dart 의 native String 을 리턴합니다.

import 'package:cp949/cp949.dart' as cp949;

const cp949CodeUnitBytes = [0xBE, 0xC6, 0xB8, 0xA7, 0xB4, 0xD9, 0xbf, 0xee];
print(cp949.decode(cp949CodeUnitBytes)); // "아름다운" 출력

encode()

dart 의 native String 을 받아 CP949 (EUC-KR) byte 배열로 (List<int>) 리턴합니다.

import 'package:cp949/cp949.dart' as cp949;

print(cp949.encode("아름다운")); // "[0xBE, 0xC6, 0xB8, 0xA7, 0xB4, 0xD9, 0xbf, 0xee]" 출력

Example

EUC-KR 로 인코딩된 http 응답을 받아오는 예시를 들면 다음과 같습니다.

import 'package:http/http.dart' as http;
import 'package:cp949/cp949.dart' as cp949;

const url = "https://euc-kr-encoded-website.co.kr";
final response = await http.get(url);
print(cp949.decode(response.bodyBytes));

Development (Contribution)

이 project 는 마크다운 린트, 커밋 메세지 린트 등 개발환경 설정을 위해 yarn과 nodejs package 들을 사용합니다.

yarn install
yarn test
yarn format:md .
yarn format .

License

MIT License. Copyright © 2020, GIL B. Chan <[email protected]>

dart-cp949's People

Contributors

jjangga0214 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.