You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
style_file() unexpectedly deletes non-ASCII characters on Windows #329
reprex::reprex_info()
#> Created by the reprex package v0.1.1.9000 on 2018-01-24utf8_string<- enc2utf8("# 忍者")
tf<-styler:::make_transformer(styler::tidyverse_style())
Encoding(tf(utf8_string))
#> [1] "unknown"
To me, while write_lines_enc() expects UTF-8 texts, there looks nothing to ensure or check that the result of fun() is in the UTF-8 encoding. Is this the problem on enc's side? Or, is it styler's fault that its transformers don't follow the convention of write_lines_enc()?
Does that mean that once krlmlr/enc#18 is merged into master and released on CRAN, styler should specify a minimal version for enc in order to avoid this problem?
@krlmlr I think krlmlr/enc#18 is ready to merge now (except when there's some special reason to use as.character()). May I expect the release of the next version of enc package soon?
Activity
yutannihilation commentedon Jan 23, 2018
Ah, sorry, I was wrong on this part:
?write_lines_encsays "It always expects text in the UTF-8 encoding", but this assumption seems to fail on my Windows.yutannihilation commentedon Jan 23, 2018
I got it. The string returned by
transformeris not encoded in the UTF-8 encoding here: https://github.com/krlmlr/enc/blob/883df89f77bb5f8646b9a8fa94cc72120cdf0c81/R/io.R#L113To me, while
write_lines_enc()expects UTF-8 texts, there looks nothing to ensure or check that the result offun()is in the UTF-8 encoding. Is this the problem on enc's side? Or, is it styler's fault that its transformers don't follow the convention ofwrite_lines_enc()?(https://github.com/krlmlr/enc/blob/883df89f77bb5f8646b9a8fa94cc72120cdf0c81/R/io.R#L109-L116)
lorenzwalthert commentedon Jan 23, 2018
Thanks for raising this @yutannihilation. I cannot reproduce the problematic behaviour on my mac.
Created on 2018-01-23 by the reprex package (v0.1.1.9000).
lorenzwalthert commentedon Jan 23, 2018
Unfortunately, I don't have time to look into that now. Need to wait another week or so.
yutannihilation commentedon Jan 23, 2018
Thanks for the quick reply. Yeah, Linux and Mac are fine. I will try to reproduce this bug on AppVeyor.
yutannihilation commentedon Jan 24, 2018
There's no hurry and I'm ok to wait several weeks, but I believe krlmlr/enc#18 will fix the problem. If you get some time, please take a look :)
lorenzwalthert commentedon Jan 29, 2018
Does that mean that once krlmlr/enc#18 is merged into master and released on CRAN, styler should specify a minimal version for
encin order to avoid this problem?lorenzwalthert commentedon Jan 29, 2018
If so, this issue should not be closed before that happens.
yutannihilation commentedon Jan 31, 2018
Yes, it does solve the problem.
@krlmlr I think krlmlr/enc#18 is ready to merge now (except when there's some special reason to use
as.character()). May I expect the release of the next version of enc package soon?