dahtah / imager

R package for image processing
GNU Lesser General Public License v3.0
187 stars 43 forks source link

Loading imager corrupts locale after Windows update #162

Closed rsbivand closed 2 years ago

rsbivand commented 2 years ago

@chrilur, a data journalist I have worked with, had his Windows PC upgraded to 21H1, 19043.1586. Following this upgrade, loading imager now corrupts his locale (R 4.1.1, imager 0.42.10 and 0.42.13, Rgui and R in a Windows terminal console):

[1] LC_COLLATE=Norwegian BokmÕl_Norway.1252
[2] LC_CTYPE=Norwegian BokmÕl_Norway.1252
[3] LC_MONETARY=Norwegian BokmÕl_Norway.1252
[4] LC_NUMERIC=C
[5] LC_TIME=Norwegian BokmÕl_Norway.1252

As you can see, the «å» in "Bokmål" is wrongly represented, even when the locale seems to be right.

He also get this in the terminal window:

> x <- "æøåÆØÅ"
> x
[1] "µ°ÕãÏ┼"
>

We looked for traces in onAttach() - not found - or onLoad(), but could not see an obvious reason why screen rendering of text would be changed. Entering "å" into an object and converting to raw showed that the hex was correct, so the problem is with rendering.

I could not reproduce the problem on Windows 21H2 19044, but I use English_United States:1252.

We did not try to see whether R 4.2.0 might resolve the problem. Is there anything that you know of that loading imager might alter in how output text is rendered for Windows 21H1? Unfortunately, we do not know the pre-upgrade Windows version.

ShotaOchi commented 2 years ago

I tried to reproduce it on R4.1.1 with imager 0.42.13 but failed. I changed my locale to Norwegian. The version of my Windows was 21H1, 19043.1586, too.

I have no idea why loading imager causes the font rendering problem. Did you reinstall both R and imager? If not, I hope it will fix the problem.

rsbivand commented 2 years ago

@ShotaOchi : thanks for your quick response!

imager was re-installed (updated from 0.42.10 to 0.42.13), not R.

@chrilur : if you upgrade R to 4.1.3, you might be able to check whether 4.1.1 is the culprit (I don't think so). Upgrading from 4.1.1 to 4.1.3 should be painless as the R ABI is fixed for patch releases, so no need to re-install packages. My guess is a setting in the OS itself that is hard to find, or maybe a difference in graphics drivers outside R. Next step will be to try 4.2.0 when it appears.

rsbivand commented 2 years ago

@chrilur tested with 4.1.3 without improvement, so something in the Windows installation details or the specific PC seems to be involved.