Skip to content

Latest commit

 

History

History
71 lines (47 loc) · 1.09 KB

README.md

File metadata and controls

71 lines (47 loc) · 1.09 KB

Ruchardet

An R port of http://code.google.com/p/uchardet/ library

Install

library(devtools)

install_github("Ruchardet", "haven-jeon")

Example

library(Ruchardet, quietly = TRUE)

nm <- "안녕하세요! 고감자입니다"
benc <- detectEncoding(nm)
benc
## [1] "UTF-8"
nme <- iconv(nm, benc, "CP949")
detectEncoding(c(nm, nme))
## [1] "UTF-8"  "EUC-KR"
# detection of unknown file encoding
unknown <- file.path(system.file("tests", package = "Ruchardet"), "shift_jis.txt")
read.table(unknown, fileEncoding = detectFileEncoding(unknown))
##                                                                                                                   V1
## 1 日本語日本語日本語日本語日本語日本語日本語日本語日本語日本語日本語日本語日本語日本語日本語日本語日本語日本語日本語
# URL encoding detection
detectFileEncoding("http://www.ppomppu.co.kr/")
## [1] "EUC-KR"
detectFileEncoding("http://freesearch.pe.kr")
## [1] "UTF-8"