Bug 1116544

Summary: [i18n] double width Unicode characters
Product: [Fedora] Fedora Reporter: Takayuki Ogawa <takayuki988>
Component: dnfAssignee: Honza Silhan <jsilhan>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: unspecified    
Version: 20CC: akozumpl, packaging-team-maint, pnemade, rholy, takayuki988, tim.lauridsen
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: hawkey-0.4.18-2.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-07-19 06:03:07 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:
Attachments:
Description Flags
patch to fix "dnf repolist all"
none
fixed fill_exact_width function and added some functions
none
fixed output.
none
There was a bug in textwrap_fill function of previous patch for i18n.py. Resending a patch. none

Description Takayuki Ogawa 2014-07-06 03:51:40 UTC
Description of problem:
When I run DNF in Japanese language environment, many lines of display output are longer than the width of screen, so the format of output is collapsed.

I looked in the code and I'm afraid the width of all unicode character is assumed equivalent.
In fact, many asian characters are twice as long width as western alphabet.

Version-Release number of selected component (if applicable):
dnf-0.5.2-1.fc20.noarch

Additional information:
In python, we can check the width of characters by
unicodedata.east_asian_width function.

Unicode Standard Annex #11
East Asian Width
http://www.unicode.org/reports/tr11/

Comment 1 Takayuki Ogawa 2014-07-06 11:00:03 UTC
Created attachment 914946 [details]
patch to fix "dnf repolist all"

Comment 2 Takayuki Ogawa 2014-07-06 11:02:44 UTC
Created attachment 914947 [details]
fixed fill_exact_width function and added some functions

Comment 3 Takayuki Ogawa 2014-07-06 11:04:49 UTC
Created attachment 914948 [details]
fixed output.

Comment 4 Takayuki Ogawa 2014-07-06 13:40:40 UTC
Created attachment 914953 [details]
There was a bug in textwrap_fill function of previous patch for i18n.py. Resending a patch.

Fixed if condition.

In addition, I found my textwrap_fill function insert new line code in a word.
But later problem is not fixed.

Comment 5 Ales Kozumplik 2014-07-07 06:31:43 UTC
Hello, thank you for the report. Can you please try one thing: when doing 'yum repolist all' with your locale settings, does the output look OK? Thanks!

Moving to our i18n guru.

Comment 6 Takayuki Ogawa 2014-07-07 11:39:43 UTC
The output of `yum repolist all` looks good.
Yum seems to using self-developed utf8_width function to check the width.
Thank you.

Comment 7 Honza Silhan 2014-07-14 17:07:58 UTC
Fixed in the upstream (e42d1de785). Some Yum functions were taken back and refactored to work with unicode literals and some code was reused from Takayuki's patches - Thanks. Next time you can make a pull request here https://github.com/akozumpl/dnf and get all the credit ;).

Comment 8 Fedora Update System 2014-07-17 06:42:38 UTC
hawkey-0.4.18-2.fc20, dnf-0.5.4-1.fc20, libsolv-0.6.4-0.git2a5c1c4.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/hawkey-0.4.18-2.fc20,dnf-0.5.4-1.fc20,libsolv-0.6.4-0.git2a5c1c4.fc20

Comment 9 Fedora Update System 2014-07-19 06:03:07 UTC
hawkey-0.4.18-2.fc20, dnf-0.5.4-1.fc20, libsolv-0.6.4-0.git2a5c1c4.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.