Skip to content

# ADD zh_TW.UTF-8 support.#3666

Closed
ralic wants to merge 2 commits into
Homebrew:masterfrom
ralic:patch-1
Closed

# ADD zh_TW.UTF-8 support.#3666
ralic wants to merge 2 commits into
Homebrew:masterfrom
ralic:patch-1

Conversation

@ralic

@ralic ralic commented Jan 11, 2018

Copy link
Copy Markdown

Before Change :

 bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

After Change :

No more warning
  • [v ] Have you followed the guidelines in our Contributing document?

  • [v ] Have you checked to ensure there aren't other open Pull Requests for the same change?

  • [v ] Have you added an explanation of what your changes do and why you'd like us to include them?

To add zh_TW.UTF-8 support and remove annoying warning from bash

  • [x ] Have you written new tests for your changes? Here's an example.

  • [v ] Have you successfully run brew tests with your changes locally?

Yes, warning message removed in both en_US.UTF-8 and zh_TW.UTF-8

Comment thread Library/Homebrew/brew.sh
@@ -1,8 +1,13 @@
# Force UTF-8 to avoid encoding issues for users with broken locale settings.
if [[ "$(locale charmap 2>/dev/null)" != "UTF-8" ]]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does locale charmap output for zh_TW.UTF-8?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It shows UTF-8. However the warning will still be there, because LC_ALL was set to en_US.UTF-8. Here is the locale details.

=>locale
LANG=zh_TW.UTF-8
LANGUAGE=zh_TW:zh
LC_CTYPE="zh_TW.UTF-8"
LC_NUMERIC="zh_TW.UTF-8"
LC_TIME="zh_TW.UTF-8"
LC_COLLATE="zh_TW.UTF-8"
LC_MONETARY="zh_TW.UTF-8"
LC_MESSAGES="zh_TW.UTF-8"
LC_PAPER="zh_TW.UTF-8"
LC_NAME="zh_TW.UTF-8"
LC_ADDRESS="zh_TW.UTF-8"
LC_TELEPHONE="zh_TW.UTF-8"
LC_MEASUREMENT="zh_TW.UTF-8"
LC_IDENTIFICATION="zh_TW.UTF-8"
LC_ALL=zh_TW.UTF-8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was your locale set to zh_TW.UTF-8 before running the brew bash script? If it was zh_TW.UTF-8 originally, then the export LC_ALL="en_US.UTF-8" shouldn't have happened in the first place.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As @apjanke said: if locale charmap outputs UTF-8 it'll never set LC_ALL.

@apjanke

apjanke commented Jan 12, 2018

Copy link
Copy Markdown
Contributor

Are you getting this warning on macOS or Linux?

I suspect this doesn't happen on macOS because the en_US locale is installed (at least by default) on all macOS systems, including non-US ones. And also because it doesn't seem to issue a warning when setting the locale to a noninstalled locale via bash. Instead, it silently falls back to the C locale. (Which is also not good.)

On my Sierra machine:

[~] $ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
[~] $ export LC_ALL=xx_XX.UTF-8
[~] $ locale
LANG="en_US.UTF-8"
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL="C"
[~] $

Does your machine have the en_US.UTF-8 locale installed on it?

@ralic

ralic commented Jan 13, 2018

Copy link
Copy Markdown
Author

You are right, I am using Debian and testing it both in English version and Chinese version. There is no en_US.UTF-8 installed by default for Chinese version. This modified script works for both English installation and Chinese installation. The later comes with server input method for typing in Chinese so I believe most Chinese reader would choose this option in installation, which means, their system will not have en_US.UTF-8 installed.

@MikeMcQuaid

Copy link
Copy Markdown
Member

I am using Debian

Closing as this isn't a macOS bug. Discuss this in Linuxbrew/brew#568.

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants