'Sublime package LANG setting

I have downloaded and unzipped Sublime 3 package for Red Hat linux. I have sublime_text in my /downloads/sublime_text_3.

When I open ./sublime_text, I get the following error

Package Control

Your system's locale is set to a value that can not handle non-ASCII characters. Package Control can not properly work unless this is fixed.

On Linux, please reference your distribution's docs for information on properly setting the LANG environmental variable. As a temporary work-around, you can launch Sublime Text from the terminal with:

LANG=en_US.UTF-8 sublime_text

I tried changing setenv LANG en_US.UTF-8 with no positive effects.



Solution 1:[1]

Have you tried the solutions given in the package control issue on Github?

If LANG=en_US.UTF-8 sublime_text and LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 sublime_text don't work, you can try the following:

Define a system wide locale [...]:

in /etc/locale.conf:

LANG="en_US.UTF-8"

And reboot your sytem.

or

simply changing only the LANG variable in /etc/locale.conf from my default setting to en_US.UTF-8, as so --

/etc/locale.conf:

LANG=en_US.UTF-8
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=

-- but Package Control continued to throw the error until I culled the file down to only the first line --

/etc/locale.conf:

LANG=en_US.UTF-8

Hope that helps someone!

You can also check this question.

Solution 2:[2]

For those without sudo (e.g. on enterprise CentOS), clear LC_ALL, set LANG, then run:

setenv LC_ALL ''
setenv LANG en_US.UTF-8
subl

Here's a one-liner launcher for csh:

/usr/bin/csh -c "setenv LC_ALL '' && setenv LANG en_US.UTF-8 && subl"

Solution 3:[3]

vim /etc/locale.gen

en_US.UTF-8 UTF-8  
en_US ISO-8859-1 

locale-gen

vim /etc/locale.conf

LANG=en_US.UTF-8

locale

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Solution 4:[4]

You can set system locale using

/etc/locale.conf

LANG=en_US.UTF-8

OR Simply run this command

localectl set-locale LANG=en_US.UTF-8

Then reboot the system.

Solution 5:[5]

Check whether you have an export of LANG, LC_ALL, or LC_CTYPE in your ~/.bashrc file, your ~/.profile file, or some other file that modifies your path. When I commented out export LC_ALL="C" from my ~/.bashrc (I can't remember why I put it there originally), the message stopped appearing on subl startup for me.

This was true even after I deleted the two lines I added to /etc/locale.conf per the top answer (restoring it to its original condition of no contents or nonexistent), and rebooted.

Solution 6:[6]

Solution for kali linux

Hey I know this is kind of solved but I spent time finding a solution for Kali Linux. According with this guy (https://forum.sublimetext.com/t/where-does-st3-look-for-locale-settings/48206) this bug happens when connecting through remote desktop not sure if this is right but it was my case.

The solution is the one above: Running LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 sublime_text.

If you are like me and like to run everything fast in the terminal then:

a) cd to /usr/bin

b) sudo nano subl (if you don't have it try: sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/bin/subl)

c) Make sure your file looks like this:

#!/bin/sh

LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /opt/sublime_text/sublime_text 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community
Solution 2 Mateen Ulhaq
Solution 3 duyCuong
Solution 4 Thamaraiselvam
Solution 5 tsbertalan
Solution 6 Mr.j