Fight against Japanese filenames: Rubymine, AWS CLI, Docker for Windows (1) --AWS CLI

Trilogy

  1. AWS CLI (this article)
  2. Rubymine (write next)
  3. Docker for Windows (write next)

Error with Japanese file name when uploading file to s3 with AWS CLI

When the following error occurs

UnicodeEncodeError: 'utf-8' codec can't encode 

And

Please check your locale settings.  The filename was decoded as: ANSI_X3.4-1968 On posix platforms, check the LC_CTYPE environment variable.

Rough procedure

  1. Maybe it's python2 so give it to python3
  2. Start over
  3. Further fails, assuming that the filename may be sjis instead of utf-8

For CentOS6

  1. Go to python3

    $ yum install python34 #Or yum search python|Search with grep 3
    $ yum install python34-setuptools #This is easy_install to use
    

At this point there are two or three easy_installs

```shell-session:For example, like this
-rwxr-xr-x 1 root root 323 November 12 09:38 2010 /usr/bin/easy_install
-rwxr-xr-x 1 root root 331 November 12 09:38 2010 /usr/bin/easy_install-2.6
-rwxr-xr-x 1 root root 334 October 11 00:17 2016 /usr/bin/easy_install-3.4
```
  1. Start over

    $aws s3
    
  2. If that doesn't work, set the language properly With sjis, it looks like the following

    LANG="ja_JP.sjis"
    LC_CTYPE="ja_JP.sjis"
    SUPPORTED="ja_JP.sjis:ja_JP:ja"
    SYSFONT="latarcyrheb-sun16"
    

You can check the locales that can be used here below

```shell-session
$ locale -a
```

Since there was no sjis, I added it like the following

```shell-session
$ localedef -f SHIFT_JIS -i ja_JP ja_JP.SJIS
```

reference

Recommended Posts

Fight against Japanese filenames: Rubymine, AWS CLI, Docker for Windows (1) --AWS CLI
Stories and solutions for AWS CLI updates