LC_CTYPE issue on OS X SOLVED!

Meet The Problem

Problem occurs when I’m using ssh working on my Ubuntu/Debian from ‘Terminal‘ of Mac OS X’s own.

I can’t remember the first time I saw

Digging

I google’ed a lot, locale-gen and dpkg-reconfigure are the two commands, and before these, they tell you to export LC_ALL=xxx.UTF-8, all these run on your debian/ubuntu.
So their solution looks like:

But the next time I ssh to my server, everything got back.
I chose to add LC_CTYPE=”en_US.UTF-8″ to /etc/default/locale.
This works for me. But I’m not root everywhere.

I typed locale in my Terminal by accident(I thought I was on a remote server XD), then I found these:

And on the server side, i ran perl, same warning came out.

Let’s do ‘export LC_CTYPE=”en_US.UTF-8″‘ or ‘export LC_ALL=”en_US.UTF-8″‘ on a local terminal then ssh to remote server from the same terminal, run perl again, no warning now.
So the easiest way solving this warning is adding the line to /etc/profile.

Solving

Till now, problem is not solved.

I cannot find out where OS X defines its default locale, tried System Preferences, ‘defaults read‘, nothing useful.

From Terminal:

I saw the LC_CTYPE=UTF-8 again.
Then I tried iTerm 2, all default settings, SAME problem.
ZOC 6, NO LC_CTYPE in env.
This means, the environment variable may be set by terminal programs.

In iTerm 2, here are the snapshots:

Version:

about

Default env:

env-1

Preferences:

Preferences

New tab after UNCHECKED:

env-2

Back to Terminal:

Default env:

Terminal Env 1

Preferences, UNCHECK this:

Preferences, uncheck this

Old Terminal, New tab, Seg fault…. LOOOOOOOOOL:

Old Terminal, New tab, Seg fault

New Terminal:

New tab env

CHECK again, another new tab:

Check again, another new tab env

PROBLEM SOLVED!

LC_CTYPE issue on OS X SOLVED! by @sskaje: https://sskaje.me/2014/01/lc-ctype-issue/