Skip to content

UTF-8 characters in filename for agg_png #87

@Darxor

Description

@Darxor

I've noticed that agg_png doesn't handle UTF-8 in file names well.

Example

library(ragg)

file <- "русское_название.png"
agg_png(file)
plot(sin, -pi, 2*pi)
dev.off()

Above code produces a file named СЂСѓСЃСЃРєРѕРµ_название.png instead of русское_название.png, like grDevices::png would. If a path has a UTF-8 in folder names, device would fail to write with agg could not write to the given file error.

I've tried to wrap filename with enc2native or enc2utf8, but it doesn't seem to help.

Session info
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=Russian_Russia.1251  LC_CTYPE=Russian_Russia.1251   
[3] LC_MONETARY=Russian_Russia.1251 LC_NUMERIC=C                   
[5] LC_TIME=Russian_Russia.1251    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] ragg_1.1.3

loaded via a namespace (and not attached):
[1] compiler_4.1.0    tools_4.1.0       textshaping_0.3.5
[4] systemfonts_1.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions