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

pander function with problem of Chinese character Error:basic_string::_S_create #272

Closed
furthermore opened this issue Aug 11, 2016 · 4 comments

Comments

@furthermore
Copy link

I use R 3.1.1 under win10
image

Only when I user pander() function chinese character cannot show,how can I solve this problem ,thanks!

@daroczig
Copy link
Member

@RomanTsegelskyi any ideas on this?

@daroczig
Copy link
Member

daroczig commented Dec 4, 2016

@furthermore, can you please add your devtools::session_info() and also try the above with the most recent version of pander installed from Github?

@elikesprogramming
Copy link

I get the same error with pander::pandoc.table when I try to avoid splitting wide tables (split.tables = Inf), if it contains non-ascii characters. The error is actually when the function calls table.expand.

Error in table.expand(x, t.width, justify, sep.col) :
basic_string::_S_create

See this example:

df1 <- data.frame(
	name = "Max Mueller", 
	desc = "Only ascii characters"
) 
pander::pandoc.table(df1, keep.line.breaks = TRUE, style = 'grid', justify = 'left', split.tables = Inf)

This works fine:

> df1 <- data.frame(
+ 	name = "Max Mueller", 
+ 	desc = "Only ascii characters"
+ ) 
> pander::pandoc.table(df1, keep.line.breaks = TRUE, style = 'grid', justify = 'left', split.tables = Inf)


+-------------+-----------------------+
| name        | desc                  |
+=============+=======================+
| Max Mueller | Only ascii characters |
+-------------+-----------------------+

But if the content has non-ascii characters (note the ü instead of ue), it fails:

> df1 <- data.frame(
+ 	name = "Max Müller", 
+ 	desc = "Now it has non-ascii characters"
+ ) 
> pander::pandoc.table(df1, keep.line.breaks = TRUE, style = 'grid', justify = 'left', split.tables = Inf)
Error in table.expand(x, t.width, justify, sep.col) : 
  basic_string::_S_create

Below the session info

> devtools::session_info()
Session info --------------------------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.4.0 (2017-04-21)
 system   x86_64, mingw32             
 ui       RStudio (1.0.143)           
 language (EN)                        
 collate  German_Germany.1252         
 tz       Europe/Berlin               
 date     2017-07-07                  

Packages ------------------------------------------------------------------------------------------------------------------------------
 package    * version date       source                           
 assertthat   0.2.0   2017-04-11 CRAN (R 3.4.0)                   
 base       * 3.4.0   2017-04-21 local                            
 bindr        0.1     2016-11-13 CRAN (R 3.4.0)                   
 bindrcpp   * 0.2     2017-06-17 CRAN (R 3.4.0)                   
 broom        0.4.2   2017-02-13 CRAN (R 3.4.0)                   
 cellranger   1.1.0   2016-07-27 CRAN (R 3.4.0)                   
 colorspace   1.3-2   2016-12-14 CRAN (R 3.4.0)                   
 compiler     3.4.0   2017-04-21 local                            
 datasets   * 3.4.0   2017-04-21 local                            
 devtools     1.13.2  2017-06-02 CRAN (R 3.4.0)                   
 digest       0.6.12  2017-01-27 CRAN (R 3.4.0)                   
 dplyr      * 0.7.0   2017-06-09 CRAN (R 3.4.0)                   
 forcats      0.2.0   2017-01-23 CRAN (R 3.4.0)                   
 foreign      0.8-68  2017-04-24 CRAN (R 3.4.0)                   
 ggplot2    * 2.2.1   2016-12-30 CRAN (R 3.4.0)                   
 glue         1.1.0   2017-06-13 CRAN (R 3.4.0)                   
 graphics   * 3.4.0   2017-04-21 local                            
 grDevices  * 3.4.0   2017-04-21 local                            
 grid         3.4.0   2017-04-21 local                            
 gtable       0.2.0   2016-02-26 CRAN (R 3.4.0)                   
 haven        1.0.0   2016-09-23 CRAN (R 3.4.0)                   
 hms          0.3     2016-11-22 CRAN (R 3.4.0)                   
 httr         1.2.1   2016-07-03 CRAN (R 3.4.0)                   
 jsonlite     1.4     2017-04-08 CRAN (R 3.4.0)                   
 knitr        1.16    2017-05-18 CRAN (R 3.4.0)                   
 lattice      0.20-35 2017-03-25 CRAN (R 3.4.0)                   
 lazyeval     0.2.0   2016-06-12 CRAN (R 3.4.0)                   
 lubridate    1.6.0   2016-09-13 CRAN (R 3.4.0)                   
 magrittr     1.5     2014-11-22 CRAN (R 3.4.0)                   
 memoise      1.1.0   2017-04-21 CRAN (R 3.4.0)                   
 methods    * 3.4.0   2017-04-21 local                            
 mnormt       1.5-5   2016-10-15 CRAN (R 3.4.0)                   
 modelr       0.1.0   2016-08-31 CRAN (R 3.4.0)                   
 munsell      0.4.3   2016-02-13 CRAN (R 3.4.0)                   
 nlme         3.1-131 2017-02-06 CRAN (R 3.4.0)                   
 pander       0.6.0   2017-07-07 Github (Rapporter/pander@c8e4a62)
 parallel     3.4.0   2017-04-21 local                            
 plyr         1.8.4   2016-06-08 CRAN (R 3.4.0)                   
 psych        1.7.5   2017-05-03 CRAN (R 3.4.0)                   
 purrr      * 0.2.2.2 2017-05-11 CRAN (R 3.4.0)                   
 R6           2.2.1   2017-05-10 CRAN (R 3.4.0)                   
 Rcpp         0.12.11 2017-05-22 CRAN (R 3.4.0)                   
 readr      * 1.1.1   2017-05-16 CRAN (R 3.4.0)                   
 readxl       1.0.0   2017-04-18 CRAN (R 3.4.0)                   
 reshape2     1.4.2   2016-10-22 CRAN (R 3.4.0)                   
 rlang        0.1.1   2017-05-18 CRAN (R 3.4.0)                   
 rstudioapi   0.6     2016-06-27 CRAN (R 3.4.0)                   
 rvest        0.3.2   2016-06-17 CRAN (R 3.4.0)                   
 scales       0.4.1   2016-11-09 CRAN (R 3.4.0)                   
 stats      * 3.4.0   2017-04-21 local                            
 stringi      1.1.5   2017-04-07 CRAN (R 3.4.0)                   
 stringr      1.2.0   2017-02-18 CRAN (R 3.4.0)                   
 tibble     * 1.3.3   2017-05-28 CRAN (R 3.4.0)                   
 tidyr      * 0.6.3   2017-05-15 CRAN (R 3.4.0)                   
 tidyverse  * 1.1.1   2017-01-27 CRAN (R 3.4.0)                   
 tools        3.4.0   2017-04-21 local                            
 utils      * 3.4.0   2017-04-21 local                            
 withr        1.0.2   2016-06-20 CRAN (R 3.4.0)                   
 xml2         1.1.1   2017-01-24 CRAN (R 3.4.0)                

@daroczig
Copy link
Member

I think this has been fixed with #296, please confirm.

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

No branches or pull requests

3 participants