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

Emoji characters on Windows #65

Closed
bwiernik opened this issue Jun 22, 2021 · 3 comments
Closed

Emoji characters on Windows #65

bwiernik opened this issue Jun 22, 2021 · 3 comments
Assignees
Labels
bug an unexpected problem or unintended behavior feature a feature request or enhancement

Comments

@bwiernik
Copy link

The special emoji characters used in the specification headers don't render correctly on Windows when printed inside of the cli functions. For example, this is what I see for the well-specified heading:

-- <U+0001F4C9><U+0001F4C8>: Well Specified Model: Assumptions ----

This could be fixed if the emoji were manually passed to cat()

cat("\U0001F4C9\U0001F4C8")

But that might be difficult to coordinate with the cli functions. It also won't work if the user is working with R GUI, R CMD, or another environment without UTF-8 support. I might suggest instead checking if the environment supports UTF-8 characters with the cli::is_utf8_output() function and only including the emoji if that returns TRUE.

@shamindras
Copy link
Owner

@bwiernik - thanks for flagging this issue, and equally importantly for suggesting ways to mitigate it. We appreciate it.

Note: We are currently on a short break and preparing for a conference currently (and wrapping up an existing PR). We will come back to this shortly after our conference in early-mid July.

shamindras added a commit that referenced this issue Jul 10, 2021
@shamindras shamindras added bug an unexpected problem or unintended behavior feature a feature request or enhancement labels Sep 24, 2021
@shamindras shamindras self-assigned this Sep 24, 2021
@shamindras
Copy link
Owner

shamindras commented Sep 24, 2021

@bwiernik in #68 - have just started on this by writing a quick reprex for the issue you had kindly flagged.

We will be adding you as a issues contributor to our next major maars NEWS release 🎉 .

Could you please help us run and test this out? The reprex file, if you wanted to run it locally, can be run by checking out the latest #68 PR branch from the maars repo:

git checkout main
git pull origin main
git fetch --all
git checkout iss-65-emoji-chars-fix

Once there you can just open up the maars.Rproj file in RStudio and run this file. Alternatively you should just be able to paste the contents of that file into a fresh R session and run.

In my session, I can print emoji's, since my session supports utf8. I was hoping you could run the file and check whether you could share a screenshot of what forcing utf8 printing in a non-utf8 supporting environment looks like. That is running these lines. Would it be possible for you to kindly take a look and let us know?

Depending on what you see in a non-utf8 supported environment, we should be able to tweak this function to print the titles without emojis, using the utf8-support check already included in this code.

current session info
Session info ────────────────────────────────────────────────────────
 setting  value                       
 version  R version 4.1.1 (2021-08-10)
 os       macOS Big Sur 10.16         
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/New_York            
 date     2021-09-24Packages ────────────────────────────────────────────────────────────
 package     * version date       lib source            
 assertthat    0.2.1   2019-03-21 [1] standard (@0.2.1) 
 backports     1.2.1   2020-12-09 [1] standard (@1.2.1) 
 broom         0.7.8   2021-06-24 [1] standard (@0.7.8) 
 cellranger    1.1.0   2016-07-27 [1] standard (@1.1.0) 
 cli           3.0.0   2021-06-30 [1] standard (@3.0.0) 
 clipr         0.7.1   2020-10-08 [1] standard (@0.7.1) 
 colorspace    2.0-2   2021-06-24 [1] standard (@2.0-2) 
 crayon        1.4.1   2021-02-08 [1] standard (@1.4.1) 
 DBI           1.1.1   2021-01-15 [1] standard (@1.1.1) 
 dbplyr        2.1.1   2021-04-06 [1] standard (@2.1.1) 
 desc          1.3.0   2021-03-05 [1] standard (@1.3.0) 
 details       0.2.1   2020-01-12 [1] standard (@0.2.1) 
 dplyr       * 1.0.7   2021-06-18 [1] standard (@1.0.7) 
 ellipsis      0.3.2   2021-04-29 [1] standard (@0.3.2) 
 fansi         0.5.0   2021-05-25 [1] standard (@0.5.0) 
 forcats     * 0.5.1   2021-01-27 [1] standard (@0.5.1) 
 fs            1.5.0   2020-07-31 [1] standard (@1.5.0) 
 generics      0.1.0   2020-10-31 [1] standard (@0.1.0) 
 ggplot2     * 3.3.5   2021-06-25 [1] standard (@3.3.5) 
 glue          1.4.2   2020-08-27 [1] standard (@1.4.2) 
 gtable        0.3.0   2019-03-25 [1] standard (@0.3.0) 
 haven         2.4.1   2021-04-23 [1] standard (@2.4.1) 
 hms           1.1.0   2021-05-17 [1] standard (@1.1.0) 
 httr          1.4.2   2020-07-20 [1] standard (@1.4.2) 
 jsonlite      1.7.2   2020-12-09 [1] standard (@1.7.2) 
 knitr         1.33    2021-04-24 [1] standard (@1.33)  
 lifecycle     1.0.0   2021-02-15 [1] standard (@1.0.0) 
 lubridate     1.7.10  2021-02-26 [1] standard (@1.7.10)
 magrittr      2.0.1   2020-11-17 [1] standard (@2.0.1) 
 modelr        0.1.8   2020-05-19 [1] standard (@0.1.8) 
 munsell       0.5.0   2018-06-12 [1] standard (@0.5.0) 
 pillar        1.6.1   2021-05-16 [1] standard (@1.6.1) 
 pkgconfig     2.0.3   2019-09-22 [1] standard (@2.0.3) 
 png           0.1-7   2013-12-03 [1] standard (@0.1-7) 
 purrr       * 0.3.4   2020-04-17 [1] standard (@0.3.4) 
 R6            2.5.0   2020-10-28 [1] standard (@2.5.0) 
 Rcpp          1.0.6   2021-01-15 [1] standard (@1.0.6) 
 readr       * 1.4.0   2020-10-05 [1] standard (@1.4.0) 
 readxl        1.3.1   2019-03-13 [1] standard (@1.3.1) 
 reprex        2.0.1   2021-08-05 [1] CRAN (R 4.1.0)    
 rlang         0.4.11  2021-04-30 [1] standard (@0.4.11)
 rprojroot     2.0.2   2020-11-15 [1] standard (@2.0.2) 
 rstudioapi    0.13    2020-11-12 [1] standard (@0.13)  
 rvest         1.0.0   2021-03-09 [1] standard (@1.0.0) 
 scales        1.1.1   2020-05-11 [1] standard (@1.1.1) 
 sessioninfo   1.1.1   2018-11-05 [1] standard (@1.1.1) 
 stringi       1.6.2   2021-05-17 [1] standard (@1.6.2) 
 stringr     * 1.4.0   2019-02-10 [1] standard (@1.4.0) 
 tibble      * 3.1.2   2021-05-16 [1] standard (@3.1.2) 
 tidyr       * 1.1.3   2021-03-03 [1] standard (@1.1.3) 
 tidyselect    1.1.1   2021-04-30 [1] standard (@1.1.1) 
 tidyverse   * 1.3.1   2021-04-15 [1] standard (@1.3.1) 
 utf8          1.2.2   2021-07-24 [1] CRAN (R 4.1.0)    
 vctrs         0.3.8   2021-04-29 [1] standard (@0.3.8) 
 withr         2.4.2   2021-04-18 [1] standard (@2.4.2) 
 xfun          0.24    2021-06-15 [1] standard (@0.24)  
 xml2          1.3.2   2020-04-23 [1] standard (@1.3.2) 

[1] /Library/Frameworks/R.framework/Versions/4.1/Resources/library

@bwiernik
Copy link
Author

I'll take a look !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants