Bug 800323 - Unicode characters break subscription-manager when executed from a subshell
Unicode characters break subscription-manager when executed from a subshell
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: subscription-manager (Show other bugs)
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: Alex Wood
Entitlement Bugs
Depends On:
Blocks: 771481 888457
  Show dependency treegraph
Reported: 2012-03-06 05:13 EST by Tomas Strachota
Modified: 2013-05-28 11:10 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-02-21 03:54:12 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Setting default output stream encoding to utf-8 (1011 bytes, patch)
2012-03-15 11:28 EDT, Tomas Strachota
no flags Details | Diff
Encoding of url params (1.11 KB, patch)
2012-03-15 11:30 EDT, Tomas Strachota
no flags Details | Diff

  None (edit)
Description Tomas Strachota 2012-03-06 05:13:29 EST
Description of problem:

Any subscription-manager action that is run against a system with orgs and envs containing international characters fails. It's most likely caused by Python's output encoding that set to 'ascii' by default.

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

Steps to Reproduce:
1. install katello, create org and env with international chars
2. set subscription-manager against that server
3. echo "$(subscription-manager orgs --username=admin --password=admin)"

Actual results:
'ascii' codec can't encode character u'\u017e' in position XXX: ordinal not in range(128)

Expected results:
It should print data normally.
Comment 2 Bryan Kearney 2012-03-07 15:01:33 EST
This is fixed in the latest subscription-manager. No change was required when using 0.99.X. QA, can you verify?
Comment 3 Tomas Strachota 2012-03-15 11:28:10 EDT
Created attachment 570325 [details]
Setting default output stream encoding to utf-8

It is still not working in our katello system tests with the latest version of subscription-manager. I have two patches that fixed the problem for me.
Comment 4 Tomas Strachota 2012-03-15 11:30:59 EDT
Created attachment 570326 [details]
Encoding of url params

A patch for python-rhsm that fixes using i18n names in url params. Probably not the cleanest one.
Comment 6 Alex Wood 2012-12-05 15:13:47 EST

I was able to reproduce the error you are receiving when running a command in a subshell.  The patch provided in comment 3 does fix the issue for me.

However, I'm wondering about the patch in comment 4.  Can you give me a scenario to test it with?

I tried the following, but everything worked correctly.

  1. Create organization in Katello with international characters in the name.
  2. Create an environment for that organization.
  3. Run subscription-manager environments --org=$name_from_step_1
Comment 7 Alex Wood 2012-12-06 13:06:00 EST
commit 056e69dc833919709bbf23d8a7b73a5345f77fdf
Author: Alex Wood <awood@redhat.com>
Date:   Wed Dec 5 15:46:57 2012 -0500

    800323: Set default output stream encoding to UTF-8.
Comment 10 John Sefler 2012-12-12 15:28:38 EST
Verifying Version...
[root@jsefler-6 ~]# rpm -q subscription-manager
CloudForms System Engine Version: 1.1.12-22.el6cf 

After configuring my system to communicate with CFSE, and creating a organization and environment on the CDSE, I can now use subscription-manager to query the availablilty of orgs and envs as follows...

[root@jsefler-6 ~]# subscription-manager orgs --username=admin
          admin Organizations

Name: 	項目
Key: 	orglabel

Name: 	ACME_Corporation
Key: 	ACME_Corporation

[root@jsefler-6 ~]# subscription-manager environments --username=admin --org=項目
Name:                 	理者

^^^ VERIFIED: The international characters used for an organization name and an environment name where properly displayed in the subscription-manager output.

Moving bugzilla status to VERIFIED
Comment 12 errata-xmlrpc 2013-02-21 03:54:12 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

Comment 13 John Sefler 2013-05-28 11:10:44 EDT
Note: The subject of this bug has been re-visited for subscription-manager-1.8 in bug 919584
See https://bugzilla.redhat.com/show_bug.cgi?id=919584#c7

Note You need to log in before you can comment on or make changes to this bug.