Comments (4)
The same thing occurs on my machine.
tempfile <- tempfile()
text <- "glück"
library(enc)
write_lines_enc(text, tempfile)
read_lines_enc(tempfile)
#> [1] ""
Session info
devtools::session_info()
#> Session info -------------------------------------------------------------
#> setting value
#> version R version 3.5.0 (2018-04-23)
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_Australia.1252
#> tz Australia/Sydney
#> date 2018-06-18
#> Packages -----------------------------------------------------------------
#> package * version date source
#> backports 1.1.2 2017-12-13 CRAN (R 3.5.0)
#> base * 3.5.0 2018-04-23 local
#> compiler 3.5.0 2018-04-23 local
#> datasets * 3.5.0 2018-04-23 local
#> devtools 1.13.5 2018-02-18 CRAN (R 3.5.0)
#> digest 0.6.15 2018-01-28 CRAN (R 3.5.0)
#> enc * 0.2.0 2018-03-03 CRAN (R 3.5.0)
#> evaluate 0.10.1 2017-06-24 CRAN (R 3.5.0)
#> graphics * 3.5.0 2018-04-23 local
#> grDevices * 3.5.0 2018-04-23 local
#> htmltools 0.3.6 2017-04-28 CRAN (R 3.5.0)
#> knitr 1.20 2018-02-20 CRAN (R 3.5.0)
#> magrittr 1.5 2014-11-22 CRAN (R 3.5.0)
#> memoise 1.1.0 2017-04-21 CRAN (R 3.5.0)
#> methods * 3.5.0 2018-04-23 local
#> Rcpp 0.12.17 2018-05-18 CRAN (R 3.5.0)
#> rmarkdown 1.9 2018-03-01 CRAN (R 3.5.0)
#> rprojroot 1.3-2 2018-01-03 CRAN (R 3.5.0)
#> stats * 3.5.0 2018-04-23 local
#> stringi 1.2.2 2018-05-02 CRAN (R 3.5.0)
#> stringr 1.3.1 2018-05-10 CRAN (R 3.5.0)
#> tools 3.5.0 2018-04-23 local
#> utils * 3.5.0 2018-04-23 local
#> withr 2.1.2 2018-03-15 CRAN (R 3.5.0)
#> yaml 2.1.19 2018-05-01 CRAN (R 3.5.0)
from enc.
In the documentation of write_lines_enc()
it says:
It [the function] always expects UTF-8.
I think the problem is that the string "glück" is encoded in the native encoding of the operating system you are using. On my mac, it is UTF-8, but I guess on Windows, the string is encoded differently. Will check tomorrow. So I think there is no issue, we just convert to utf encoding first using enc::to_utf8()
.
from enc.
So I think there is no issue, we just convert to utf encoding first using
enc::to_utf8()
.
How about always applying enc::to_utf8()
to text
inside enc's functions?
from enc.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.
from enc.
Related Issues (20)
- Faster version of enc2latin1() and enc2alien()
- Sort keys HOT 2
- Class that hosts a list of names HOT 3
- Get rid of utf8 class HOT 2
- Exception handling HOT 1
- Rename to enc HOT 8
- C implementation
- Add missing version tag HOT 2
- Consider using `LEVELS` instead of accessing sxpinfo directly HOT 2
- Clarifying life cycle HOT 1
- Export detect_sep()
- Integrate vctrs
- Release enc 0.2.1 HOT 1
- Utf-8 class also needs to re-encode names HOT 1
- Consider as.utf8 method for lists? HOT 1
- README needs to give more advice HOT 3
- Remove Encoding<-() override HOT 1
- read_lines() and write_lines() HOT 3
- Support for UTF-8 encoded language symbols HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enc.