Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1766445

Summary: UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 55: ordinal not in range(128)
Product: Red Hat Enterprise Linux 7 Reporter: Douglas Schilling Landgraf <dougsland>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED NOTABUG QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: high Docs Contact:
Priority: unspecified    
Version: 7.7CC: csnyder, jhnidek, wpoteat
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-22 18:54:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1752522    

Description Douglas Schilling Landgraf 2019-10-29 04:50:22 UTC
Description of problem:

If users with non US unicode try to enable a repository that is already enabled subscription-manager will raise an Unicode error.

Version-Release number of selected component (if applicable):

RHEL 7 family:

# rpm -qa | grep subscription-manager
subscription-manager-rhsm-1.24.23-1.el7.x86_64
subscription-manager-rhsm-certificates-1.24.23-1.el7.x86_64
subscription-manager-1.24.23-1.el7.x86_64

or 

subscription-manager-rhsm-1.24.13-3.el7_7.x86_64
subscription-manager-rhsm-certificates-1.24.13-3.el7_7.x86_64
subscription-manager-1.24.13-3.el7_7.x86_64


How reproducible:
1. Edit the locale, example:
# cat /etc/locale.conf 
LANG=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=

2. Reboot

3. Try to enable a repo which is already enabled
# env LC_ALL=C subscription-manager repos --enable rhel-7-server-rhv-4.3-manager-rpms --enable jb-eap-7.2-for-rhel-7-server-rpms
Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 9, in <module>
    load_entry_point('subscription-manager==1.24.13', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/subscription_manager.py", line 85, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2922, in main
    ret = CLI.main(self)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 506, in main
    return_code = self._do_command()
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2260, in _do_command
    rc = self._set_repo_status(repos, rl, self.options.repo_actions)
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 2358, in _set_repo_status
    print(_("Repository '%s' is enabled for this system.") % repo.id)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 4: ordinal not in range(128)

Actual results:
raised Unicode error

Expected results:
Just print a error message to users (not UnicodeEncodeError raise)

Comment 2 Douglas Schilling Landgraf 2019-10-29 04:55:58 UTC
Proposal patch: https://github.com/candlepin/subscription-manager/pull/2179

Comment 3 Douglas Schilling Landgraf 2020-01-22 18:54:29 UTC
Using env -i LC_ALL=C  solves the issue. Thanks!