View source: R/change.encoding.R
change.encoding | R Documentation |
This function is a wrapper around iconv()
that allows for converting
character encoding of multiple text files in a corpus folder, preferably
into UTF-8.
change.encoding(corpus.dir = "corpus/", from, to = "utf-8",
keep.original = TRUE, output.dir = NULL)
corpus.dir |
path to the folder containing the corpus. |
from |
original character encoding. See the Details section (below) for some hints on how to get the original encoding. |
to |
character encoding to convert into. |
keep.original |
shall the original files be stored? |
output.dir |
folder for the reencoded files. |
Stylo works on UTF-8-enconded texts by default. This function allows you to convert your corpus, if not yet encoded in UTF-8. To check the current encoding of text files in your corpus folder, you can use the function check.encoding()
.
The function saves reencoded text files.
Steffen Pielström
check.encoding
## Not run:
# To replace the old versions with the newly encoded, but retain them
# in another folder:
change.encoding = function(corpus.dir = "~/corpora/example/",
from = "ASCII", to = "utf-8")
# To place the new version in another folder called "utf8/":
change.encoding = function(corpus.dir = "~/corpora/example/",
from = "ASCII",
to = "utf-8",
output.dir = "utf8/")
# To simply replace the old version:
change.encoding = function(corpus.dir = "~/corpora/example/",
from = "ASCII",
to = "utf-8",
keep.original = FALSE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.