-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pander + R 3.4.0 → either a failure or an encoding issue #296
Comments
@RomanTsegelskyi any ideas regarding the Rcpp error message when using R 3.4.0? |
I can confirm this bug in Spanish locale, but I don't get an error, it's just wrongly encoded. The bug disappers in R 3.3.3 |
For me it is the oposite: colnames and rownames work fine, but the data is incorrectly encoded in output. This only happens in Windows, and it appears to happen both in R
I have access to a linux box, and it does not happen in linux (which uses UTF-8). I tried setting
Trying Below the session info.
|
I created a data.frame df
# vidurkis PI_apatine_riba PI_virsutine_riba n
# Pagal „z“ formulę 54.9 52.4 57.3 24
# Pagal „t“ formulę 54.9 52.3 57.5 24 And run library(pander)
debugonce(pandoc.table.return)
Sys.setlocale(locale = "Lithuanian")
df <- readRDS("df.Rds")
pander(df) Before code breaking in lines 582-583, object # lines 582-583 in `pandoc.table.return` where the error occurs:
res <- paste0(res, paste(apply(t, 1, function(x) paste0(table.expand(x,
t.width, justify, sep.col), sep.row)), collapse = "\n")) Other code needed to run these lines: # Function, defined inside `pander::pandoc.table.return`
table.expand <- function(cells, cols.width, justify, sep.cols) {
.Call("pander_tableExpand_cpp", PACKAGE = "pander",
cells, cols.width, justify, sep.cols, style)
}
# Parameters before calling `table.expand`
t.width <- c(23, 10, 17, 19, 4)
justify <- c("centre", "centre", "centre", "centre", "centre")
sep.col <- c("", " ", "" )
style <- "multiline" After leaving the debugging mode, I loaded the first row of "t.Rds" and created the analogous line as a character vector t <- readRDS("t.Rds")[1, ]
the_names <- names(t)
# The contents of `t0` are same contents as in `t`
t0 <- c("**Pagal „z“ formulę**", "54.9", "52.4", "57.3", "24")
names(t0) <- the_names
print(t0)
# t.rownames vidurkis PI_apatine_riba PI_virsutine_riba n
# "**Pagal „z“ formulę**" "54.9" "52.4" "57.3" "24"
print(t)
# t.rownames vidurkis PI_apatine_riba PI_virsutine_riba n
# "**Pagal „z“ formulę**" "54.9" "52.4" "57.3" "24"
sapply(t0, Encoding)
# t.rownames vidurkis PI_apatine_riba PI_virsutine_riba n
# "unknown" "unknown" "unknown" "unknown" "unknown"
sapply(t, Encoding)
# t.rownames vidurkis PI_apatine_riba PI_virsutine_riba n
# "UTF-8" "unknown" "unknown" "unknown" "unknown"
table.expand(t0, t.width, justify, sep.col)
# [1] " **Pagal „z“ formulę** 54.9 52.4 57.3 24 "
table.expand(t, t.width, justify, sep.col)
## Error in table.expand(t, t.width, justify, sep.col) :
## basic_string::_S_create
Any ideas why does the encoding change and cause this problem and how it's possible to fix it? p.s. This comment could be the "more information" for #280 Objects t and df.zip |
Thanks a lot for the detailed info, really helpful! @RomanTsegelskyi, would you have a chance to look into this? |
Sorry I missed all the notifications before, I will try to look into this |
Is there any news on this issue? |
I've been exploring this issue and have found that the culprit is |
Thanks, @lselzer! @RomanTsegelskyi, any chance you might be able to look into this? |
using enc2native inside I can make a PR if you are willing to accept it. |
Yes, it solves the issue. I tried your code, tried to reproduce your error but I couldn't
|
Similar problems on a German Locale since switching from R3.3 to R3.4 (Windows). I just tried with R3.5, but that didn’t change anything. Seems as if things get encoded wrongly in the rownames if German characters (e.g. “Ä”) are present there, in the colnames if present there, and interestingly only in the rownames if present in rownames and colnames.
hö A ä Ä o C ü |
Hi there, I am also experiencing encoding issues on Windows with R 3.5.1 and Pander 0.6.2. I have been trying to insert unicode for no-break spaces to indent factor levels in my tables. Here are three examples of what I am trying to do. Example 1 uses a normal space that is ignored by Pander(); examples 2 and 3 use the unicode "\u00A0" which appears as  instead of a space.
|
I tested #326 in a Windows VM started and seems to do the trick, but please confirm. |
Thanks; I downloaded and installed "pander-table-expand-fallback.zip" today. Unfortunately, for me the result is the same as before. sessionInfo() attached base packages: other attached packages: loaded via a namespace (and not attached): |
Hello, R version 3.5.1 (2018-07-02) locale: attached base packages: |
I tried on my home computer, and can also confirm success with this: |
I had an issue trying to print a data frame with cyrillic column names:
Installing the patch mentionned in the above comment resolved the issue. (Whereas using |
This reverts commit 77959c2.
I had the same issue with German which is solved by |
@daroczig Do you plan on merging this issue? If not, pls let me know... I am holding off pushing an update of summarytools to CRAN (which will include translations) until the issue is resolved. Thx! |
Sorry for the delay, getting this done today. |
@daroczig It seems that currently CRAN version of |
Is |
I've similar issue but the comment didn't resolved the new issue
|
|
While using
pander
andR
version 3.4.0 I faced either an error or an encoding issue:Error message:
Result:
The problem disappears when I switch back to
R
3.3.3.Is there a way to overcome this bug without switching back to previous versions of
R
?The text was updated successfully, but these errors were encountered: