3

For some reason, wget has started printing all of its messages in Russian, but only when run from within PyCharm's terminal. Why is this happening and how can I change it back to English?

screenshot

I am on OSX 10.13, and am using wget 1.19.4_1 installed using Homebrew. I have used wget on this computer before, and the text was in English. I cannot understand Russian, so nothing on this computer has ever been set to use Russian.

When I run ...$ locale, this is the result:

LANG=
LC_COLLATE="C"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

Here's what I've found so far

  • This only happens for terminals in JetBrains IDEs -- I have tried both PyCharm and JGrasp, and they are both affected. When run in the OSX Terminal app, wget outputs English text. It would still be nice to know why this is happening and how to fix it.
  • This problem seems to affect only wget
  • Reinstalling wget using brew does not seem to have any effect.
  • There is no en_US locale in /usr/local/Cellar/wget/1.19.4_1/share/locale/, but I do not know if this could be the cause of my problem.
  • Copying .../en_GB/ (where ... is wget's locale folder) into a new folder called .../en_US/ does not get rid of the Russian text. Nor does replacing .../ru/ with .../en_GB/. I'm not sure exactly how a locale is defined, so this may or may not mean anything.
lowtex
  • 707
  • 4
  • 22
  • Does that happen everywhere (e.g. when you open a new terminal window)? You appear to be in a virtualenv in some project in your screenshot. – Ry- Feb 10 '18 at 04:36
  • It only happens in terminal panes in my IDEs -- PyCharm and JGrasp. New terminals are all the same way, and restarting the computer/IDEs does not change anything. As far as I can tell, its just wget. When I run it from a normal terminal window, the output is in English as it should be. – lowtex Feb 10 '18 at 04:57
  • I'm voting to close this question as off-topic because your question is not "Programming" related it is more appropriate for the StackExchange sites [**Super User**](http://superuser.com/) or [**Unix & Linux**](http://unix.stackexchange.com/). – David C. Rankin Feb 10 '18 at 05:51
  • @DavidC.Rankin I can understand this, however it might be worth noting that this problem appears to be a problem with (or caused by) an IDE, which gives it a measure of relevance to "Programming". I have changed the title so it reflects that a bit more. – lowtex Feb 10 '18 at 05:57
  • 1
    It's a close call. There are some software use cases that are more programming than others, so no dings for asking it, but here the issue seems environment related, whether that is in PyCharm or JGrasp, I haven't a clue, but you are either being hacked (joking) or something is mucking with a LOCALE setting somewhere and that is unrelated to anything you are doing programmatically as far as I can tell. – David C. Rankin Feb 10 '18 at 06:12
  • 1
    Do you get different locale results for a terminal in Pycharm, and out of it? – Guy Feb 10 '18 at 11:35

2 Answers2

3

This just happened to me, except in french.

My fix: force in the lang values in the terminal

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

This has wget happy; I've added them to ~/.profile now to see if it keeps them away forever.

stevel
  • 12,567
  • 1
  • 39
  • 50
  • Steve, you're on the right track. I did not test `LANG`, but running `export LC_ALL="en_US.UTF-8"` solves the problem. Oddly, adding this line to `~/.profile` does not preserve the fix, however (inside of PyCharm). Fortunately, adding the line to `~/.bashrc` instead did work for me. – lowtex Nov 11 '18 at 02:11
0

jGRASP is using a pty to connect to external programs, and some other IDEs are probably doing the same. So it's possible that new ptys created the way these IDEs are doing it are defaulting to the wrong locale.

From jGRASP or another IDE you can compile and run a Java or C program to print the default locale to verify this. For Java it is java.util.Locale.getDefault() .

The source for the jGRASP pty connection is in .../jGRASP.app/Contents/Resources/jgrasp/src/wedge.c . You can see how the pty is created there. You can also modify and recompile to .../jgrasp/jbin/osx_run if it will help to trace down the problem. Compiling on OS X requires no special parameters, just: cc -o ../jbin/osx_run wedge.c .

lbarowski
  • 411
  • 3
  • 2