Bug 683881 - Incorrect Russian characters in Yast messages
Summary: Incorrect Russian characters in Yast messages
Status: RESOLVED FIXED
: 536472 (view as bug list)
Alias: None
Product: openSUSE 11.4
Classification: openSUSE
Component: YaST2 (show other bugs)
Version: Final
Hardware: Other Other
: P5 - None : Minor (vote)
Target Milestone: ---
Assignee: Martin Vidner
QA Contact: Jiri Srain
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-30 19:36 UTC by Ilya Chernykh
Modified: 2011-05-27 15:28 UTC (History)
6 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
screenshot (141.84 KB, image/png)
2011-03-30 19:36 UTC, Ilya Chernykh
Details
NBSP is displayed just fine in qt yast (56.86 KB, image/png)
2011-04-14 08:50 UTC, Alex Minton
Details
Fix patch (untested!) (830 bytes, patch)
2011-04-18 10:09 UTC, Takashi Iwai
Details | Diff
Patch (1.25 KB, patch)
2011-05-27 10:16 UTC, Thomas Göttlicher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Chernykh 2011-03-30 19:36:40 UTC
Created attachment 422286 [details]
screenshot

User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; ru; rv:1.9.1.18) Gecko/20110320 SUSE/2.0.13-1.1 SeaMonkey/2.0.13

When installing packages, incorrect characters appear in Yast message instead of digits of the current and average download speed.

See the screenshot.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Comment 2 Thomas Göttlicher 2011-04-11 14:55:09 UTC
It seems the translation uses characters not supported by the font.
Comment 3 Karl Eichwalder 2011-04-12 08:19:20 UTC
Can we go for a different font?  Do we have the reported string actually in our yast messages or is this somehow inherited from glibc?  Please, type in the message here, then I could grep for it.
Comment 4 Alex Minton 2011-04-12 11:05:53 UTC
I bet it's inherited, since there's only a placeholder in yast message. It is in "base" module:
msgid "%1 (on average %2)"
msgstr "%1 (среднее %2)"
Comment 5 Karl Eichwalder 2011-04-12 14:57:28 UTC
Thanks.  SO it is either a font or a yast/glibc problem.  I've no idea how to fix this.  Takashi, can you please help with it?
Comment 6 Ilya Chernykh 2011-04-13 08:49:04 UTC
I could add that this appears only in numbers, not in other messages.
Comment 7 Takashi Iwai 2011-04-14 07:01:07 UTC
Judging from the screen shot, a bogus glyph is shown in the thousands separator.
What shows the following command in your system?

    % LANG=ru_RU printf "%'02.f" 123456.78 | hexdump -C

On mine, it's like:
    00000000  31 32 33 a0 34 35 36 2c  37 38                    |123.456,78|
    0000000a

That is, the thousands separator is 0xa0.
Comment 8 Takashi Iwai 2011-04-14 07:38:40 UTC
Seems that you need to run LANG=ru_RU.UTF-8.  Otherwise the non-breaking space isn't coverted to UTF-8.  With ru_RU.UTF-8, the separator becomes 0xc2 0xa0.

If this is correct, the next step is to check whether this character can be shown properly with YaST / Qt.
Comment 9 Alex Minton 2011-04-14 07:45:46 UTC
Takashi, my output is somewhat glitchy comparing to yours.
Actual command gives "invalid number" error:
minton@mintonlaptop:~> LANG=ru_RU printf "%'02.f" 123456.78 | hexdump -C
bash: printf: 123456.78: недопустимое число
00000000  30 30                                             |00|
00000002

Without decimal part output gives correct separator:
minton@mintonlaptop:~> LANG=ru_RU printf "%'02.f" 123456 | hexdump -C
00000000  31 32 33 c2 a0 34 35 36                           |123..456|
00000008

With russian decimal separator (we have comma instead of dot) it accepts a rounded number:
minton@mintonlaptop:~> LANG=ru_RU printf "%'02.f" 123456,78 | hexdump -C
00000000  31 32 33 c2 a0 34 35 37                           |123..457|
00000008

Using ru_RU.UTF-8 does not change anything.
Comment 10 Takashi Iwai 2011-04-14 08:06:22 UTC
If you are already running in the Russian locale, LANG=xxx isn't needed.  So, the actual thousands separator is a NBSP and 0xc2 0xa0 is the correct UTF-8 sequence for it.

That is, I see no problem in glibc, so far, supposing YaST shows the number with the printf format above.

A possible bug would be that YaST processes the printf above in a different encoding than UTF-8, then showing it as UTF-8 (or vice versa).

Please check whether a string with NBSP can be displayed properly in YaST in Russian locale.
If this works, it means that font and Qt are OK.  If not, check how the number is formatted in YaST.

Anyway, reassigning back to YaST guys.  I'm no i18n expert after all :)
Comment 11 Alex Minton 2011-04-14 08:50:04 UTC
Created attachment 424882 [details]
NBSP is displayed just fine in qt yast

I specifically modified and recompiled translations to test NBSP displaying itself. Edits are marked with red arrows. So QT and font are OK, its either yast or libzypp issue.
Comment 12 Takashi Iwai 2011-04-15 12:26:01 UTC
Arvin pointed the upstream bugzilla:
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16006

And the old entry for novell bug 573692.

Actually, printf() works on 11.4 with NBSP and UTF-8, but C++ iostream doesn't work.
Is this the problem, supposing YaST uses C++?   If my guess is right, a workaround would be to use printf() explicitly for the formatting.
Comment 13 Arvin Schnell 2011-04-15 12:36:04 UTC
Only with C++ iostreams is it possible to set the locale without
affecting the global locale (esp. in a threaded environment).

And AFAIR we don't want to change to global locale for numeric output
since it can cause trouble.

See also the original bug #460094 leading to use of iostream.
Comment 14 Takashi Iwai 2011-04-15 13:32:42 UTC
OK, then the only chance is to work around it somehow (replacing 0xc2 with 0xc2 0xa0 in-place) or finally to fix libstdc++ for this long-standing (almost 7 years old!) bug...
Comment 15 Takashi Iwai 2011-04-18 10:07:50 UTC
I meant a quick-n-dirty patch like below...
Comment 16 Takashi Iwai 2011-04-18 10:09:03 UTC
Created attachment 425343 [details]
Fix patch (untested!)
Comment 18 Thomas Göttlicher 2011-04-27 14:47:33 UTC
Ilya, any news?
Comment 19 Ilya Chernykh 2011-05-01 01:11:35 UTC
No, the patch does not work. Still the same incorrect characters.
Comment 20 Takashi Iwai 2011-05-02 08:46:48 UTC
Thomas, are you sure that the package in comment 17 includes any relevant fix?  I don't see it in the source.
Comment 21 Thomas Göttlicher 2011-05-05 07:49:30 UTC
(In reply to comment #20)
> Thomas, are you sure that the package in comment 17 includes any relevant fix? 
> I don't see it in the source.
Sorry, my bad. 

The patch is included in:
http://download.opensuse.org/repositories/home:/tgoettlicher:/Factory/openSUSE_11.4/i586/yast2-core-2.21.0-14.1.i586.rpm

http://download.opensuse.org/repositories/home:/tgoettlicher:/Factory/openSUSE_11.4/x86_64/yast2-core-2.21.0-14.1.x86_64.rpm

Could you please test?
Comment 22 Thomas Göttlicher 2011-05-19 14:58:26 UTC
Ilya, have you tested the fix yet?
Comment 23 Ilya Chernykh 2011-05-27 09:52:36 UTC
I am not 100% sure but probably this has been fixed by the patch.
Comment 24 Thomas Göttlicher 2011-05-27 10:16:01 UTC
Created attachment 431784 [details]
Patch

Martin, could you please review and apply the appended patch to yast2-core? Thank you.
Comment 25 Martin Vidner 2011-05-27 15:26:52 UTC
Well, that is a fine example of an ugly hack ;-)

But thanks for pointing out the upstream bug. I took the hint and used wide characters for a cleaner fix.

SVN: http://svn.opensuse.org/viewvc/yast?view=revision&revision=64129
RPM: yast2-core-2.21.2
OBS: https://build.opensuse.org/request/show/71744
Comment 26 Martin Vidner 2011-05-27 15:28:27 UTC
*** Bug 536472 has been marked as a duplicate of this bug. ***