fontawesome icon indicating copy to clipboard operation
fontawesome copied to clipboard

warning with package first loading for v4 icon compatible check

Open dracodoc opened this issue 2 years ago • 2 comments

With shiny::icon() calling fontawesome::fa_i(), there is a check for v4 icon names. With a fresh R session, this process will generate a warning even when icon name is a valid v5 name.

This is a simple shiny app, icon used is valid in both v4 and v5.

library(shiny)
ui <- fluidPage(
  icon("file")
)
server <- function(input, output, session) {
}
shinyApp(ui, server)

Loading required package: shiny
Warning in name %in% fa_tbl$v4_name :
  strings not representable in native encoding will be translated to UTF-8

It seemed that fa_i checked icon name and didn't find any problem, but still this checking process generated warning when there are some string encoding issues in fa_tbl$v4_name. This might be related to my Chinese locale, but I think it still need to be fixed in some way.

My session info

> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 14393)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936  LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936 LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

dracodoc avatar Nov 10 '21 20:11 dracodoc

Easier way to trigger the warning:

> library(fontawesome)
> fa_i("file")
Warning message:
In mget(objectNames, envir = ns, inherits = TRUE) :
  strings not representable in native encoding will be translated to UTF-8

dracodoc avatar Nov 11 '21 19:11 dracodoc

I have the same problem (with a a german or english locale).

For example the exclamation-triangle icon throws a warning but renders fine in a shiny app.

This Font Awesome icon ('exclamation-triangle') does not exist:
* if providing a custom `html_dependency` these `name` checks can 
  be deactivated with `verify_fa = FALSE`

When I use fontawesome::fa_i("exclamation-triangle") the warning is shown as well and the icon renders (shiny::icon calls fa_i after all) but when I use fontawesome::fa("exclamation-triangle"), it throws an error and no icon is shown.

DavZim avatar Aug 07 '22 10:08 DavZim

This is now fixed in https://github.com/rstudio/fontawesome/pull/96.

rich-iannone avatar Oct 19 '22 13:10 rich-iannone