Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Merge branch 'r-0.1' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed Nov 15, 2017
2 parents 1a5d0da + ee68208 commit d9cabae
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 129 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: enc
Title: Portable Tools for 'UTF-8' Character Data
Date: 2017-11-12
Version: 0.0-18
Version: 0.1
Authors@R: person("Kirill", "Müller", role = c("aut", "cre"), email = "krlmlr+r@mailbox.org")
Description:
Implements an S3 class for storing 'UTF-8' strings, based on regular character vectors.
Expand All @@ -14,7 +14,6 @@ Imports:
methods
Suggests:
digest,
pillar,
readr,
rlang,
testthat
Expand Down
91 changes: 8 additions & 83 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,10 @@
## enc 0.0-18 (2017-11-12)
## enc 0.1 (2017-11-12)

- `read_lines_enc()` returns objects of class `utf8`.
- Add `type_sum.utf8()` without strong dependency on pillar.
Initial release.


## enc 0.0-17 (2017-11-10)

- Prepare CRAN release.


## enc 0.0-16 (2017-10-23)

- Test up to and including R 3.1.


## enc 0.0-15 (2017-10-23)

- All methods now use snake_case.
- Use the tic package for testing.


## enc 0.0-11 (2017-08-22)

- More robust handling if only some files could be transformed in `transform_lines_enc()` (#16, @lorenzwalthert).
- Fix `write_back` argument to `transform_lines_enc()` (#14, @lorenzwalthert).
- New `try_read_lines_enc()`.
- `transform_lines_enc()` now uses `try_read_lines_enc()`, therefore only warns if file is missing.


## enc 0.0-10 (2017-02-03)

- `transform_lines_enc()` auto-detects EOL delimiter.


## enc 0.0-9 (2017-02-02)

- New `transform_lines_enc()`.
- New `read_lines()` and `write_lines()` for robust reading and writing of text files (#8).


## enc 0.0-8 (2016-08-09)

- Full test coverage.
- Test on AppVeyor.
- Names of `utf8` objects are also stored as `utf8` objects, also on update (#4).


## enc 0.0-7 (2016-08-09)

- New general `to_encoding()` with variants `to_native()`, `to_latin1()` and `to_alien()`. The existing `to_utf8` now uses `to_encoding()` (#3).


## enc 0.0-6 (2016-08-09)

- Fix `R CMD check` errors.
- New `to_utf8()` performs deep conversion to UTF-8, including names and other attributes (#2, #5).


## enc 0.0-5 (2016-08-09)

- New `encoding()`, returns `"ASCII"` for pure ASCII strings and behaves identical to `base::Encoding()` otherwise.
- New `all_utf8()`, returns an atomic logical that indicates if all elements of a character vector are UTF-8 encoded; this includes pure ASCII stringsi (#1).
- Remove `Encoding<-` override, with documentation (#7).


# enc 0.0-4 (2016-06-14)

- Implement `c.utf8()`.


# enc 0.0-3 (2016-06-13)

- Pass `R CMD check`.


# enc 0.0-2 (2016-06-13)

- Updating the encoding is a no-op for `utf8` objects.


# enc 0.0-1 (2016-06-13)

- Initial release
- `utf8` class with constructor, coercion, formatting, printing, and checked updates
- `utf8` class with constructor, coercion, combination, formatting, printing, and checked updates.
- `to_encoding()` performs deep encoding conversion of objects, including names and other attributes. Variants: `to_utf8()`, `to_native()`, `to_latin1()` and `to_alien()`.
- `encoding()`, returns `"ASCII"` for pure ASCII strings and behaves identically to `base::Encoding()` otherwise.
- `all_utf8()`, returns a logical scalar that indicates if all elements of a character vector are UTF-8 encoded; this includes pure ASCII strings.
- `read_lines_enc()`, `try_read_lines_enc()`, and `write_lines_enc()` for robust reading and writing of text files. Returns/accepts objects of class `utf8`.
- `transform_lines_enc()`, with robust handling if only some files could be transformed in `transform_lines_enc()`. Uses `try_read_lines_enc()`, therefore only warns if file is missing. Auto-detects and maintains EOL delimiter.
2 changes: 1 addition & 1 deletion R/io.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ try_read_lines_enc <- function(path, file_encoding = "UTF-8", n = -1L, ok = TRUE
#' @inheritParams read_lines_enc
#' @export
write_lines_enc <- function(text, path, file_encoding = "UTF-8", sep = "\n") {
raw_data <- get_raw_file_data(text, file_encoding, sep)
raw_data <- get_raw_file_data(as.character(text), file_encoding, sep)
writeBin(raw_data, path)
}

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ output: github_document

# enc

[![Travis-CI Build Status](https://travis-ci.org/krlmlr/enc.svg?branch=master)](https://travis-ci.org/krlmlr/enc) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/krlmlr/enc?branch=master&svg=true)](https://ci.appveyor.com/project/krlmlr/enc) [![Coverage Status](https://img.shields.io/codecov/c/github/krlmlr/enc/master.svg)](https://codecov.io/github/krlmlr/enc?branch=master) [![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/enc)](https://cran.r-project.org/package=enc)
[![Travis-CI Build Status](https://travis-ci.org/krlmlr/enc.svg?branch=master)](https://travis-ci.org/krlmlr/enc) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/krlmlr/enc?branch=master&svg=true)](https://ci.appveyor.com/project/krlmlr/enc) [![codecov](https://codecov.io/gh/krlmlr/enc/branch/master/graph/badge.svg)](https://codecov.io/gh/krlmlr/enc)
[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/enc)](https://cran.r-project.org/package=enc)

Portable tools for UTF-8 character data

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

enc
====
===

[![Travis-CI Build Status](https://travis-ci.org/krlmlr/enc.svg?branch=master)](https://travis-ci.org/krlmlr/enc) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/krlmlr/enc?branch=master&svg=true)](https://ci.appveyor.com/project/krlmlr/enc) [![Coverage Status](https://img.shields.io/codecov/c/github/krlmlr/enc/master.svg)](https://codecov.io/github/krlmlr/enc?branch=master) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/enc)](https://cran.r-project.org/package=enc)
[![Travis-CI Build Status](https://travis-ci.org/krlmlr/enc.svg?branch=master)](https://travis-ci.org/krlmlr/enc) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/krlmlr/enc?branch=master&svg=true)](https://ci.appveyor.com/project/krlmlr/enc) [![codecov](https://codecov.io/gh/krlmlr/enc/branch/master/graph/badge.svg)](https://codecov.io/gh/krlmlr/enc) [![CRAN\_Status\_Badge](http://www.r-pkg.org/badges/version/enc)](https://cran.r-project.org/package=enc)

Portable tools for UTF-8 character data

Expand Down Expand Up @@ -40,18 +40,18 @@ Example

``` r
library(enc)
enc(c("a", "ä"))
utf8(c("a", "ä"))
#> [1] "a" "ä"
as_enc(1)
as_utf8(1)
#> [1] "1"

a <- enc("ä")
a <- utf8("ä")
a[2] <- "ö"
class(a)
#> [1] "enc"
#> [1] "utf8"

data.frame(abc = letters[1:3], enc = enc(letters[1:3]))
#> abc enc
data.frame(abc = letters[1:3], utf8 = utf8(letters[1:3]))
#> abc utf8
#> 1 a a
#> 2 b b
#> 3 c c
Expand Down
9 changes: 4 additions & 5 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Recreated boilerplate code using tools::package_native_routine_registration_skeleton(), do we still need a copyright entry?

## Test environments
* local OS X install, R 3.4.2

* local Ubuntu 17.04 install, R 3.4.2
* ubuntu 12.04 (on travis-ci), R-devel, R-release, R-oldrel, R 3.2 and R 3.1
* win-builder (devel and release)

Expand All @@ -10,7 +13,3 @@
* This is a new release.

* The wording of "encodings" and "portably" seems correct.

## Reverse dependencies

This is a new release, so there are no reverse dependencies.
32 changes: 3 additions & 29 deletions src/init.c
Original file line number Diff line number Diff line change
@@ -1,39 +1,13 @@
/*
* R : A Computer Language for Statistical Data Analysis
* Copyright (C) 2012 The R Core Team.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, a copy is available at
* http://www.r-project.org/Licenses/
*/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <R.h>
#include <Rinternals.h>
#include <stdlib.h> // for NULL

#include "encoding.h"
#include <R_ext/Rdynload.h>


#define CALLDEF(name, n) {#name, (DL_FUNC) &name, n}

static const R_CallMethodDef CallEntries[] = {
CALLDEF(encoding, 1),
CALLDEF(all_utf8, 1),

{"all_utf8", (DL_FUNC) &all_utf8, 1},
{"encoding", (DL_FUNC) &encoding, 1},
{NULL, NULL, 0}
};

Expand Down

0 comments on commit d9cabae

Please sign in to comment.