Software⏱️ 2 min read📅 2026-06-03

How to Fix UTF-8 Error – In OS X Lion, LANG is not set to UTF-8, how to fix it?

Set LANG to UTF-8 in OS X Lion for PostgreSQL setup.

Quick Answer: Run the command 'export LANG=en_US.UTF-8' or add it to your shell configuration file (~/.bashrc or ~/.zshrc) to set the language to UTF-8.

In OS X Lion, the LANG environment variable is not set to UTF-8 by default. This can cause issues when setting up PostgreSQL or other applications that rely on Unicode support.

🔍 Why This Happens

  • The LANG environment variable is set to the default system locale, which in OS X Lion is set to US English. This means that the system uses a different character encoding than UTF-8.

🛠️ Step-by-Step Verified Fixes

Method 1: Set LANG to UTF-8

  1. Step 1: Open the Terminal app and type the following command: `export LANG=en_US.UTF-8`

Method 2: Set LOCALE to UTF-8

  1. Step 1: Open the Terminal app and type the following command: `export LC_ALL=en_US.UTF-8`

🎯 Final Words

To summarize, setting LANG or LOCALE to UTF-8 will resolve the issue. Remember to restart your Terminal app after making these changes.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions