You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

误删Mac .lproj文件导致psql输出字符编码异常求助

Fixing Psql Output Garbled Characters After Deleting .lproj Files on Mac

Hey there, I’ve run into similar locale-related hiccups on Mac before, so let’s work through fixing this psql output issue step by step. Those <E2><94><80> sequences are actually UTF-8 byte representations of the table border characters (like ─ and │)—the problem comes from broken system locale settings after deleting those .lproj localization files, not psql itself (which is why reinstalling didn’t resolve it).

Here’s what you can try:

1. Check Terminal’s Character Encoding

First, make sure your Terminal is configured to use UTF-8, since that’s what psql relies on to render border characters correctly:

  • Open Terminal, go to Terminal > Settings > Profiles
  • Select your active profile, then navigate to the Advanced tab
  • Under "Character Encoding", choose Unicode (UTF-8)
  • Close and reopen Terminal to apply the change

2. Reset Locale Environment Variables

The deleted .lproj files likely messed up your system’s locale configuration. Let’s force UTF-8 for your shell:

  • Temporary test: Run these commands in Terminal, then launch psql to see if it fixes the issue:
    export LC_ALL=en_US.UTF-8
    export LANG=en_US.UTF-8
    
  • Permanent fix: Edit your shell config file (depending on whether you use bash or zsh):
    • For zsh (default on newer Macs): Open ~/.zshrc in a text editor, add the two lines above, then run source ~/.zshrc to apply.
    • For bash: Edit ~/.bash_profile or ~/.bashrc instead, then run source ~/.bash_profile.

3. Rebuild System Localization Cache

If adjusting locale variables alone doesn’t work, we can rebuild Mac’s localization database to fix missing .lproj-related data:

  • Run this command in Terminal (you’ll need your admin password):
    sudo /usr/libexec/locale-gen
    
  • Additionally, go to System Settings > General > Language & Region, drag "English" to the top of the language list, then restart your Mac. This forces the system to reload core localization settings.

4. Reset Psql’s Configuration (Optional)

If the above steps don’t help, try resetting psql’s user-specific config to rule out any custom settings interfering:

  • Delete the psql config file (if it exists):
    rm ~/.psqlrc
    
  • Launch psql again—it will use default output formatting settings.

After trying these steps, your psql table borders should show up as the proper │ and ─ characters instead of the garbled byte sequences.

内容的提问来源于stack exchange,提问作者MTR

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:16:17