Skip to content
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

Encoding discrepancy in multiline tables (line feed vs no line feed) #335

Closed
dcomtois opened this issue Dec 25, 2018 · 1 comment
Closed

Comments

@dcomtois
Copy link
Contributor

Encodings, encodings. What would we do without those headaches I wonder. This concerns only Windows AFAIK.

I found that in multiline tables (using styles "grid" or "multiline"), strings are not encoded consistently; if there is a line feed (\n), things are fine. But when there is none, things go wrong:

x1 <- structure(list(
  Variable = c("SomeVar", "JustNAs"),
  Stats = c("Moy (é-t) : 1.02 (0.07)  \n \ Min : 0.86", "Aucune donnée valide")), 
  row.names = 1:2, 
  class = 'data.frame') 
pander::pander(x1)

## ----------------------------------------
##  Variable              Stats            
## ---------- -----------------------------
##  SomeVar    Moy (é-t) : 1.02 (0.07)     
##                     Min : 0.86          
## 
##  JustNAs       Aucune donnée valide    
## ----------------------------------------

The string in the upper right cell is encoded in latin1, in accordance with my locale setting, but the one on the bottom right is is actually encoded in UTF-8 (but interpreted as latin1).

Now by simply adding a \n at the end of the bottom string, we get consistent results:

x2 <- structure(list(
  Variable = c("SomeVar", "JustNAs"),
  Stats = c("Moy (é-t) : 1.02 (0.07)  \n \ Min : 0.86", "Aucune donnée valide\n")), 
  row.names = 1:2, 
  class = 'data.frame') 
pander::pander(x2)

## ----------------------------------------
##  Variable              Stats            
## ---------- -----------------------------
##  SomeVar    Moy (é-t) : 1.02 (0.07)     
##                     Min : 0.86          
## 
##  JustNAs       Aucune donnée valide     
## ----------------------------------------

Both strings are properly encoded in latin1. Unfortunately, since I can't build pander (neither on Windows nor on Linux), I can't debug it. :\

@dcomtois
Copy link
Contributor Author

I realized that the fix for issue #296 (pander@06c2f65) solves this problem as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant