Last data update: 2014.03.03

R: Wrapper of iconv for Japanese encoding
sjis2utf8R Documentation

Wrapper of iconv for Japanese encoding

Description

These functions are to encode Japanese characters from SJIS/JIS/EUC-JP to UTF-8.

Usage

sjis2utf8(x, CP932=TRUE)
eucjp2utf8(x)
jis2utf8(x)

Arguments

x

A character vecter

CP932

logical. If you like to use Shift-JIS instread of CP932, set CP932 = FALSE. The default is TRUE

Details

The major Japanese encoding systems are Shift-JIS (CP932), JIS (ISO-2022-JP), EUC-JP, and recently UTF-8. Exchanging Japanese strings data between the different platforms is often the cause of unreadable illegal characters. Since iconv could be the solution of this issues, these functions are written for the handy use of iconv, in partifular, when importing an old dataset or from the different platform.

Value

A character vector

Author(s)

Susumu Tanimura aruminat@gmail.com

See Also

iconv and localeToCharset.

Examples

x <- iconv(zenkaku$upper, from="UTF-8", to="CP932")
sjis2utf8(x)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Nippon)
Loading required package: maptools
Loading required package: sp
Checking rgeos availability: TRUE
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Nippon/sjis2utf8.Rd_%03d_medium.png", width=480, height=480)
> ### Name: sjis2utf8
> ### Title: Wrapper of iconv for Japanese encoding
> ### Aliases: sjis2utf8 eucjp2utf8 jis2utf8
> ### Keywords: character Japanese language
> 
> ### ** Examples
> 
> x <- iconv(zenkaku$upper, from="UTF-8", to="CP932")
> sjis2utf8(x)
[1] "<U+FF21><U+FF22><U+FF23><U+FF24><U+FF25><U+FF26><U+FF27><U+FF28><U+FF29><U+FF2A><U+FF2B><U+FF2C><U+FF2D><U+FF2E><U+FF2F><U+FF30><U+FF31><U+FF32><U+FF33><U+FF34><U+FF35><U+FF36><U+FF37><U+FF38><U+FF39><U+FF3A>"
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>