Bug 1116544 - [i18n] double width Unicode characters
Summary: [i18n] double width Unicode characters
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 20
Hardware: All
OS: Linux
unspecified
low
Target Milestone: ---
Assignee: Honza Silhan
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-06 03:51 UTC by Takayuki Ogawa
Modified: 2014-07-19 06:03 UTC (History)
6 users (show)

Fixed In Version: hawkey-0.4.18-2.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-07-19 06:03:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
patch to fix "dnf repolist all" (6.75 KB, patch)
2014-07-06 11:00 UTC, Takayuki Ogawa
no flags Details | Diff
fixed fill_exact_width function and added some functions (2.09 KB, patch)
2014-07-06 11:02 UTC, Takayuki Ogawa
no flags Details | Diff
fixed output. (21.38 KB, patch)
2014-07-06 11:04 UTC, Takayuki Ogawa
no flags Details | Diff
There was a bug in textwrap_fill function of previous patch for i18n.py. Resending a patch. (2.08 KB, patch)
2014-07-06 13:40 UTC, Takayuki Ogawa
no flags Details | Diff

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.


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