#117 closed defect (bug) (fixed)
Credits API character set
Reported by: | knutsp | Owned by: | coffee2code |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | API | Keywords: | |
Cc: |
Description
credits.php
doesn't show (translators) names with non-ASCII characters properly. Looks ugly. See http://core.trac.wordpress.org/ticket/17861
Attachments (1)
Change History (25)
#4
follow-up:
↓ 8
@
11 years ago
I'm happy to open-source this API. Currently it relies on the hardcoded email addresses for Gravatars, so I'd have to change that.
#5
@
11 years ago
- Priority changed from low to normal
Any traction on this?
Still contributors to core are not honoured on credits.php
with their name displayed correctly, when their names have some non-ASCII characters. Isn't it quite embarrassing? Something, somewhere is not UTF-8 clean, or?
#6
@
11 years ago
Confirmed the issue with validators on a nb_NO intall. The screenshot from #wp17861 is still relevant:
#8
in reply to:
↑ 4
@
9 years ago
Replying to nacin:
I'm happy to open-source this API.
@nacin, any progress on this?
It really doesn't look good for WordPress, so it should be fixed.
#9
@
9 years ago
Been here for a year or two, yep: https://meta.svn.wordpress.org/sites/trunk/api.wordpress.org/public_html/core/credits/
#10
follow-up:
↓ 11
@
9 years ago
Thank you for the quick answer, Nacin.
So, it's open source now. To suggest a fix for this you only need to know how. I would like to try creating a patch, but I would need some guidance. I know how to create a patch for core. But this? And how to test that my patch works? Would I then need a fork of api.wordpress.org set up somewhere?
I was very close to ask a question about this to @matt in the Q&A session at WCEU, but was too shy and slow to bring it up in time before the last question. My bad. Now I have try try here, to get some attention to this bug.
Anyone else I could mention here, who would be able to pick it up, or give me a hint on where to start?
#11
in reply to:
↑ 10
@
9 years ago
Replying to knutsp:
Thank you for the quick answer, Nacin.
So, it's open source now. To suggest a fix for this you only need to know how. I would like to try creating a patch, but I would need some guidance. I know how to create a patch for core. But this? And how to test that my patch works? Would I then need a fork of api.wordpress.org set up somewhere?
Typically for "meta" following this guide in the handbook to get started is normally all that is needed:
https://make.wordpress.org/meta/handbook/about/get-involved/setting-up-your-machine/
Though api.wordpress.org
has yet to be added to the WordPress Meta Environment :(
https://github.com/iandunn/wordpress-meta-environment/blob/master/TODO.md
So ideally adding api.wordpress.org
to the WordPress Meta Environment would be the best start, though I'm not sure what has yet to be open sourced from https://meta.svn.wordpress.org/sites/trunk/api.wordpress.org and @iandunn would be the best person to offer some feedback here on the best way forward here.
#12
follow-ups:
↓ 15
↓ 17
@
9 years ago
The presumption in closing #core17861 and moving discussion to this ticket has been that the Credits API is at fault. As a proper solution it could well be.
However, there is a solution to the problem by patching core. Attached is 117.diff which patches wp-admin/credits.php.
The crux of the fix is that the Credits API applies utf8_encode()
on user display_names sent via the API (see 1, 2, 3). So if wp-admin/credits.php simply does utf8_decode()
on the string it receives, the proper characters are displayed (at least for the ones I tested).
The easiest test is to apply the patch and view the credits for WP 4.3. In the props list, you should see Bjørn Johansen
. Before the patch, that would appear as Bjørn Johansen
. (He is also a translator for the locale nb_NO, and the fix applies to that section as well.)
For the locale Norsk nynorsk (nn_NO), Eivind Ãdegard
correctly displays as Eivind Ødegard
.
I tried a few other locales with similar improvements.
Please test and see if it resolves the character display issues you've seen with credits. If so, we might reopen #core17861 and close this.
#13
@
9 years ago
Is this a case where we should not be utf8_encoding the data in the credits API? How is the data stored in the database? It might be a case where we're storing it as utf8 to begin with, perhaps, so encoding it is the wrong thing to do here.
#14
@
9 years ago
I'm not sure about the justification for how it's being handled by the credits API.
The data in question is the user data (specifically display_name) from the global users table, so there's that familiar issue (latin1 table).
But yeah, it seems we could alternatively remove the use of utf8_encode()
in the credits API and things would work as well. I'm not sure if there are unforeseen ramifications of doing so. The use of remove_accents()
doesn't appear as though it can be omitted, so names still wouldn't be perfect, but at least they would look much better.
#16
@
9 years ago
The data in question is the user data (specifically display_name) from the global users table, so there's that familiar issue (latin1 table).
Yeah, that is the thing about w.org tables. Just because it lives in a latin1 column does not necessarily mean it actually is latin1. We've had these tables a long, long time, and the data might be utf8 stored in latin1 and no conversion ever performed.
I think we need a practical approach here. If all the existing data work fine without the encode, then dump the encode and insta-fix all the existing installs. If we need special handling for some, then we can special handle those. Long term we convert the lot, but long is super-long as you well know.
#17
in reply to:
↑ 12
;
follow-up:
↓ 18
@
9 years ago
Replying to coffee2code:
The easiest test is to apply the patch and view the credits for WP 4.3. In the props list, you should see
Bjørn Johansen
. Before the patch, that would appear asBjørn Johansen
. (He is also a translator for the locale nb_NO, and the fix applies to that section as well.)
https://make.wordpress.org/polyglots/teams/?locale=nb_NO
For the locale Norsk nynorsk (nn_NO),
Eivind Ãdegard
correctly displays asEivind Ødegard
.
https://make.wordpress.org/polyglots/teams/?locale=nn_NO
Just adding an additional use case of the "shared user" table used by polyglots and that both Bjørn and Eivind "display names" currently display as expected on the respective polyglots teams pages linked above.
The source for the above: /wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/views/locale-details.php#L69
Another vote for the "dump the encode and insta-fix" here as the above never encodes them in the first place.
#18
in reply to:
↑ 17
@
9 years ago
Replying to netweb:
Another vote for the "dump the encode and insta-fix" here as the above never encodes them in the first place.
I see. The data are actually stored as UTF8 despite the table charset. We all know MySQL doesn't care when charset is Latin1, it takes anything, like binary. So it's wrong to assume actual Latin1 encoding just because data is stored in such table/column.
Remove the encoding function at get an instant fix at the same time.
#19
@
9 years ago
- Owner set to coffee2code
- Resolution set to fixed
- Status changed from new to closed
In 1878:
#20
@
9 years ago
FYI: Could take up to 12 hours for caches to clear for this to be fully reflected.
#22
@
9 years ago
I am so happy to don’t cringe and feel embarrassed every time I see the credits screen now.
Thank you everyone involved :-)
Related: #23