1\name{Iconv}
2\alias{Iconv}
3\alias{Iconv.annotation}
4\alias{Iconv.data.set}
5\alias{Iconv.importer}
6\alias{Iconv.item}
7\alias{Iconv.value.labels}
8
9\title{Convert Annotations, and Value Labels between Encodings}
10\description{
11  This function uses the base package function \code{\link[base]{iconv}}
12  to translate variable descriptions (a.k.a variable labels) and
13  value labels of \code{\link{item}}, \code{\link{data.set}},
14  and \code{\link{importer}} objects into a specified encoding.
15
16  It will be useful in UTF-8 systems when data file come in some ancient
17  encoding like 'Latin-1' as long used by Windows systems.
18  }
19\usage{
20
21Iconv(x,from="",to="",\dots)
22\method{Iconv}{annotation}(x,from="",to="",\dots)
23\method{Iconv}{data.set}(x,from="",to="",\dots)
24\method{Iconv}{importer}(x,from="",to="",\dots)
25\method{Iconv}{item}(x,from="",to="",\dots)
26\method{Iconv}{value.labels}(x,from="",to="",\dots)
27
28}
29\arguments{
30  \item{x}{an object of which attributes are to be re-encoded.}
31  \item{from}{a character string desribing the original encoding}
32  \item{to}{a character string desribing the target encoding}
33  \item{\dots}{further arguments, passed to \code{\link[base]{iconv}}}
34}
35\value{
36  Iconv returns a copy of its first argument with re-encoded
37  attributes.
38}
39\seealso{
40  \code{\link[base]{iconv}}, \code{\link[base:iconv]{iconvlist}}
41}
42\examples{
43\dontrun{
44# Locate an SPSS 'system' file and get info on variables, their labels etc.
45ZA5302 <- spss.system.file("Daten/ZA5302_v6-0-0.sav",to.lower=FALSE)
46
47# Convert labels etc. from 'latin1' to the encoding of the current locale.
48ZA5302 <- Iconv(ZA5302,from="latin1")
49
50# Write out the codebook
51writeLines(as.character(codebook(ZA5302)),
52           con="ZA5302-cdbk.txt")
53
54# Write out the description of the varialbes (their 'variable labels')
55writeLines(as.character(description(ZA5302)),
56            con="ZA5302-description.txt")
57}
58}
59\keyword{misc}
60