Closed Bug 432847 Opened 16 years ago Closed 16 years ago

Character corruption in download count

Categories

(addons.mozilla.org Graveyard :: Localization, defect)

defect
Not set
minor

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: rdoherty, Assigned: wenzel)

References

()

Details

Attachments

(2 files)

Attached image Screenshot
I see a character being corrupted in the download counts for RU.
This affects also cs, fi, sk etc.
Summary: [RU] Character corruption in download count → Character corruption in download count
http://php.net/number_format suggests that the function number_format() used here is not multibyte-safe. However the comment is from 2006 so I am not sure if this persists but this may well be causing the problem seen here.
I wrote a little workaround for a multi-byte safe number_format function. It first uses '.' and ',' characters, then str_replace()s the actual characters in. Seems to work just fine with Russian.
Assignee: nobody → fwenzel
Status: NEW → ASSIGNED
Attachment #322494 - Flags: review?(rdoherty)
Comment on attachment 322494 [details] [diff] [review]
multibyte-safe number_format

Not sure if Ryan is around to look at this? But it should be quite easy to review/test. Thanks.
Attachment #322494 - Flags: review?(morgamic)
I can review later this week if necessary.
(In reply to comment #6)
> I can review later this week if necessary.
> 

Yes please, it's a small fix, but immediately publicly obvious on every page for the people using these locales, so I think we should get it fixed.
Comment on attachment 322494 [details] [diff] [review]
multibyte-safe number_format

Me likey -- works for me, and as expected for the locales I looked at.
Attachment #322494 - Flags: review?(morgamic) → review+
Comment on attachment 322494 [details] [diff] [review]
multibyte-safe number_format

BTW - you will have to unbitrot your helper function.
Oh yeah, I fixed the conflict before checking it in. trunk had mildly outgrown this patch ;)

It's in r14159.

Thanks!
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: push-needed
Resolution: --- → FIXED
Target Milestone: --- → 3.4.3
Version: unspecified → 3.2
Attachment #322494 - Flags: review?(rdoherty)
I need to reopen this: According to http://fredericiana.com/?p=1287&cp=1#comment-156454 I need to reopen this because the function won't work for the specific case when you format a number with decimals, and use commas as digit group separator and a point as the decimal separator.

It's due to str_replace first replacing commans by points, and then replacing *all* points by commas afterwards.

Replacing the placeholders by something uncommon may fix this, or using a regular expression function.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
I changed the placeholders in r14187.
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Resolution: --- → FIXED
Verified FIXED using https://preview.addons.mozilla.org/ru/firefox/addon/3780, as well as the front, add-on detail, search, and browse pages of the cs, fi, and sk locales, where I spot-checked (comment 1).
Status: RESOLVED → VERIFIED
FYI: Wladimir Palant commented on my blog mentioning that the whole "grouping numbers in 3" thing does not apply to some locales, including Japanese. So while this bug makes things look prettier, it's not quite "correct" yet. But that's beyond the scope here and probably not a high priority right now.
push-needed keyword removed, but I still see this using live page https://addons.mozilla.org/sk/firefox/. REOP?
Dang it, apparently I fixed all occurrences of number_format except that one. (Vlado: Check the search results page, for example). Reopening.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Fixed in r15531. Sorry I missed this.
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Keywords: push-needed
Resolution: --- → FIXED
Target Milestone: 3.4.3 → 3.4.5
Thanks, Stephen! I felt kind of embarrassed too, missing the most obvious spot of all ;)
3.4.5 was pushed on Friday.
Keywords: push-needed
Blocks: 435635
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: