Sathiya Narayanan
Sathiya Narayanan

Reputation: 641

File with foreign characters downloaded from s3 using s3cmd is coming as?

I am trying to download a file from S3 using s3cmd command-line. The file is having foreign characters like (楽曲満載アプリ!!最新曲から懐かしの曲、気になるあの曲も検索できる). But when I download this file in my ubuntu machine and open the file, using vi command, the characters are getting replaced as (??????). I am not sure why this issue is occurring. Any help/suggestions would be much appreciated. Thanks in advance.

Upvotes: 0

Views: 337

Answers (1)

Sathiya Narayanan
Sathiya Narayanan

Reputation: 641

I have finally resolved the issue. Posting here so that it can help someone in the future. Based on the hint given by Will about the settings of ubuntu terminal, I investigated on the locale of the machine. I saw the locale was en_US. To see the default locale, type locale in your terminal.

**P.S if the locale you want is not available then follow this link to install the locale

$ sudo locale-gen "en_IN"
Generating locales...
  en_IN... done
Generation complete.

$ sudo dpkg-reconfigure locales
Generating locales...
  en_IN... up-to-date
Generation complete.

** In my case the locale was something like

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE=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=

I got the locale of the system where the file was opening properly

It was something like

LANG=en_IN
LANGUAGE=en_IN:en
LC_CTYPE="en_IN"
LC_NUMERIC="en_IN"
LC_TIME="en_IN"
LC_COLLATE="en_IN"
LC_MONETARY="en_IN"
LC_MESSAGES="en_IN"
LC_PAPER="en_IN"
LC_NAME="en_IN"
LC_ADDRESS="en_IN"
LC_TELEPHONE="en_IN"
LC_MEASUREMENT="en_IN"
LC_IDENTIFICATION="en_IN"
LC_ALL=

What I did was, I opened the locale file by using the command

sudo vi /etc/default/locale

and replaced the content of the file with

LANG=en_IN
LANGUAGE=en_IN:en
LC_CTYPE="en_IN"
LC_NUMERIC="en_IN"
LC_TIME="en_IN"
LC_COLLATE="en_IN"
LC_MONETARY="en_IN"
LC_MESSAGES="en_IN"
LC_PAPER="en_IN"
LC_NAME="en_IN"
LC_ADDRESS="en_IN"
LC_TELEPHONE="en_IN"
LC_MEASUREMENT="en_IN"
LC_IDENTIFICATION="en_IN"
LC_ALL=

After making this change I restarted the machine and now I open the file and baammmm. The chinese characters were showing up as expected. Thanks @Will for the hint and this link for making my day :)

Upvotes: 1

Related Questions