plotly / plotly/plotly.R

Korean(UTF-8) encoding breaks when texts provided by `str_glue`

未关闭
#2,101 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述


Korean(UTF-8) encoding breaks when texts provided by str_glue

Brief description of the problem
  • Korean(UTF-8) encoding breaks (it returns a unicode like string '<U...><U...>') in shiny application operated on docker
  • works properly with docker based on mac; does not with docker based on linux server
  • breaks only and if only when a plot including Korean texts that is provided with function str_glue is ported to plotly
  • Korean texts that is not related to the function str_glue does not break
docker envirionments
FROM rocker/shiny-verse:latest

# system libraries of general use
RUN apt-get update && apt-get install -y \
    sudo \
    pandoc \
    pandoc-citeproc \
    libcurl4-gnutls-dev \
    libcairo2-dev \
    libxt-dev \
    libssl-dev \
    libssh2-1-dev

### install R packages required
RUN R -e "install.packages(c('hms','devtools'))"
RUN R -e "devtools::install_version('shiny', version='1.6.0', dependencies=T)"
RUN R -e "devtools::install_version('shinydashboard', version='0.7.1', dependencies=T)"
RUN R -e "devtools::install_version('plotly', version='4.9.4.1', dependencies=T)"
RUN R -e "devtools::install_version('DT', version='0.19', dependencies=T)"
RUN R -e "devtools::install_version('tidyverse', version='1.3.1', dependencies=T)"
RUN R -e "devtools::install_version('data.table', version='1.14.2', dependencies=T)"
RUN R -e "devtools::install_version('scales', version='1.1.1', dependencies=T)"
RUN R -e "devtools::install_version('bdscale', version='2.0.0', dependencies=T)"
RUN R -e "devtools::install_version('hrbrthemes', version='0.8.0', dependencies=T)"
RUN R -e "devtools::install_version('showtext', version='0.9-4', dependencies=T)"
RUN R -e "devtools::install_version('stringi', version='1.7.3', dependencies=T)"
insert reprex here
font_add_google("Nanum Gothic")
showtext_auto()

df
# A tibble: 13 × 4
   col           TRT  CTRL total
   <chr>      <int> <int> <int>
 1 72365    25   152   177
 2 72368    25   143   168
 3 72369    25    54    79
 4 74927    25   151   176
 5 70647    25    93   118
 6 76992    25   111   136
 7 79735    25   106   131
 8 74516    25   161   186
 9 70920    25   125   150
10 78630    25   164   189
11 79495    21   125   146
12 79496    24   145   169
13 70105     0    66    66

p <- df %>%
    ggplot(aes(x = '', y = total, text = str_glue("ID: {col}\n처리군 건수: {TRT}\n전체 건수: {total}"))) +
    geom_boxplot(color = "gray") +
    geom_point(aes(x = '', y = total, color = TRT==0), size = 2.5, position = position_jitterdodge()) +
    scale_color_manual(values = c("#DA135F", "gray")) +
    xlab("") + ylab("") + guides(color = 'none') +
    theme(axis.ticks.x=element_blank(), axis.text.x=element_blank()) +
    theme_ipsum(base_family = "Nanum Gothic")
ggplotly(p, tooltip = c("text")) %>%
    layout(xaxis = list(title = "", visible = TRUE), showlegend = FALSE)

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue 中的 R reprex 开始,比较它在基于 macOS 和基于 Linux 的 Docker 环境中的行为。跟踪韩语工具提示文本从 str_glue 经过 ggplotly 和 plotly 的过程;完成的标准是韩语文本能够正确显示,而不是在 plotly 输出中显示为类似 Unicode 的字符串。

由索引模型根据 Issue 内容生成。

评估

技术栈
plotly, r
领域
data-visualization
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。