...
Description of problem: The following error is shown when running `LC_ALL=C subscription-manager list --consumed` ~~~ UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128) ~~~ When sos runs commands it explicitly sets "LC_ALL=C" so that collation etc. is predictable regardless of the locale that the system is configured to use. Since this does not permit non-ASCII characters in ASCII encodings it leads to errors when these appear in the output of the command (probably due to some names or other values that are using characters that do not exist in ASCII). That's why it is better to set codecs explicitly or to set the 'errors' keyword argument to a value that either ignores these non-encodable values, or that replaces them with hex escapes: string.encode('utf8', errors='ignore') string.encode('utf8', errors='replace') It's possible that today sos would be better off setting LC_ALL to a value that /does/ allow Unicode, i.e. LC_ALL=C.UTF-8 but this would still leave this bug in subscription-manager - a user setting LC_ALL=C would still see the same problem. Version-Release number of selected component (if applicable): subscription-manager-cockpit-1.26.16-1.el8.noarch subscription-manager-rhsm-certificates-1.26.16-1.el8.x86_64 python3-subscription-manager-rhsm-1.26.16-1.el8.x86_64 subscription-manager-initial-setup-addon-1.26.16-1.el8.x86_64 dnf-plugin-subscription-manager-1.26.16-1.el8.x86_64 subscription-manager-1.26.16-1.el8.x86_64 How reproducible: 100% Steps to Reproduce: yum install glibc-langpack-ja localectl set-locale LANG=ja_JP.UTF-8 Register the system `LC_ALL=C subscription-manager list --consumed` or run sos and try to cat the contents of sos_commands/subscription_manager/* Actual results: LC_ALL=C subscription-manager list --consumed ~~~ ------------------------------------------- Traceback (most recent call last): File "/usr/sbin/subscription-manager", line 11, in <module> load_entry_point('subscription-manager==1.26.16', 'console_scripts', 'subscription-manager')() File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 87, in main return managercli.ManagerCLI().main() File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2996, in main ret = CLI.main(self) File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main return cmd.main() File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 536, in main return_code = self._do_command() File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2704, in _do_command self.print_consumed(service_level=self.options.service_level, filter_string=self.options.filter_string, pid_only=self.options.pid_only) File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2721, in print_consumed print(" " + _("Consumed Subscriptions")) UnicodeEncodeError: 'ascii' codec can't encode characters in position 3-18: ordinal not in range(128) ~~~ Expected results: subscription-manager identity ~~~ システム ID: d85f22b4-6cee-4bb4-a374-512355231a91 名前: ktordeur-rhel82-test-register.sysmgmt.lan 組織名: Default Organization 組織 ID: Default_Organization 環境名: Library ~~~ subscription-manager list --installed ~~~ ------------------------------------------- インストール済み製品のステータス ------------------------------------------- 製品名: Red Hat Enterprise Linux for x86_64 製品 ID: 479 バージョン: 8.2 アーキテクチャー: x86_64 状態: サブスクライブ済み 状態の詳細: 開始: 2013年04月24日 終了: 2022年01月01日 ~~~ Additional info: [root@ktordeur-rhel82-test-register ~]# locale LANG=ja_JP.UTF-8 LC_CTYPE=en_US.UTF-8 LC_NUMERIC="ja_JP.UTF-8" LC_TIME="ja_JP.UTF-8" LC_COLLATE="ja_JP.UTF-8" LC_MONETARY="ja_JP.UTF-8" LC_MESSAGES="ja_JP.UTF-8" LC_PAPER="ja_JP.UTF-8" LC_NAME="ja_JP.UTF-8" LC_ADDRESS="ja_JP.UTF-8" LC_TELEPHONE="ja_JP.UTF-8" LC_MEASUREMENT="ja_JP.UTF-8" LC_IDENTIFICATION="ja_JP.UTF-8" LC_ALL= [root@ktordeur-rhel82-test-register ~]# localectl System Locale: LANG=ja_JP.UTF-8 VC Keymap: us X11 Layout: n/a [root@ktordeur-rhel82-test-register ~]# subscription-manager facts --list | grep default_locale system.default_locale: en_US.UTF-8 [root@ktordeur-rhel82-test-register ~]# LANG=ja_JP.UTF-8 subscription-manager facts --list | grep default_locale system.default_locale: en_US.UTF-8
Won't Do