[Bug] Wrong Encoding Special Characters

Maniaplanet public API, ManiaConnect system and the open source PHP SDK.

Moderator: NADEO

kremsy
Posts: 1711
Joined: 21 Jul 2011, 09:51

[Bug] Wrong Encoding Special Characters

Post by kremsy » 07 Jul 2017, 17:50

Some of the new characters in name are returned wrongly at the webservices.

Example: Character: "🎮" Response from Webservice: ""
Lukas alias Kremsy, Developer of:
ManiaControl: http://www.maniacontrol.com
ParagonLeague: http://league.paragon-esports.com
MPAseco: http://mpaseco.org
ManiaViewer: http://www.maniaviewer.com

User avatar
magnetik
Nadeo
Nadeo
Posts: 1623
Joined: 01 Feb 2012, 19:13
Location: Paris
Contact:

Re: [Bug] Wrong Encoding Special Characters

Post by magnetik » 10 Jul 2017, 07:59

I cannot confirm. I see that it's encoded as "\ud83c\udfae\" which seems correct

What client are you using?
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!

kremsy
Posts: 1711
Joined: 21 Jul 2011, 09:51

Re: [Bug] Wrong Encoding Special Characters

Post by kremsy » 14 Jul 2017, 15:08

GuzzleHttp

Code: Select all

			$requestLink = $appLink . "/login/oauth2/access_token";

			$client = new Client(); //GuzzleHttp\Client
			$result = $client->post($requestLink, ['form_params' => ['grant_type' => 'authorization_code', 'client_id' => $appId, 'client_secret' => $appSecret, 'code' => $_REQUEST["code"], 'redirect_uri' => URL::action("UserController@loginmp4"),]]);

			$response = json_decode($result->getBody()->getContents());


			$request = $client->request('GET', $appLink . "/webservices/me", ['headers' => ['Authorization' => "Bearer " . $response->access_token, 'Accept' => "application/json"]]);

			$response = json_decode($request->getBody()->getContents());
			
Lukas alias Kremsy, Developer of:
ManiaControl: http://www.maniacontrol.com
ParagonLeague: http://league.paragon-esports.com
MPAseco: http://mpaseco.org
ManiaViewer: http://www.maniaviewer.com

kremsy
Posts: 1711
Joined: 21 Jul 2011, 09:51

Re: [Bug] Wrong Encoding Special Characters

Post by kremsy » 17 Jul 2017, 19:47

Same bug btw on the ManiaPlanet Playerpage.
Lukas alias Kremsy, Developer of:
ManiaControl: http://www.maniacontrol.com
ParagonLeague: http://league.paragon-esports.com
MPAseco: http://mpaseco.org
ManiaViewer: http://www.maniaviewer.com

User avatar
magnetik
Nadeo
Nadeo
Posts: 1623
Joined: 01 Feb 2012, 19:13
Location: Paris
Contact:

Re: [Bug] Wrong Encoding Special Characters

Post by magnetik » 18 Jul 2017, 13:07

What bug on the playerpage? You mean in the nickname?

I've added one in my nickname, and it's displayed well: https://www.maniaplanet.com/players/magnetik.org
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!

User avatar
magnetik
Nadeo
Nadeo
Posts: 1623
Joined: 01 Feb 2012, 19:13
Location: Paris
Contact:

Re: [Bug] Wrong Encoding Special Characters

Post by magnetik » 18 Jul 2017, 15:56

kremsy wrote:
07 Jul 2017, 17:50
Example: Character: "🎮" Response from Webservice: ""
Theses are 2 different char, first one is U+1F3AE (the game pad) and the second one is U+E964 (something like a shaped stone)
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!

kremsy
Posts: 1711
Joined: 21 Jul 2011, 09:51

Re: [Bug] Wrong Encoding Special Characters

Post by kremsy » 18 Jul 2017, 16:01

Could be that I copied a wrong one but both not working,

check here as well:

https://pasteboard.co/GBwi4cJ.png

MP website top nam wrong, in server its right, and this is for all player with special characters.
Lukas alias Kremsy, Developer of:
ManiaControl: http://www.maniacontrol.com
ParagonLeague: http://league.paragon-esports.com
MPAseco: http://mpaseco.org
ManiaViewer: http://www.maniaviewer.com

zocka
Posts: 196
Joined: 15 Jun 2010, 17:56

Re: [Bug] Wrong Encoding Special Characters

Post by zocka » 18 Jul 2017, 17:58

https://unicode-table.com/en/blocks/private-use-area/ wrote:In Unicode, the Private Use Areas (PUA) are three ranges of code points (U+E000–U+F8FF in the BMP, and in planes 15 and 16) that, by definition, will not be assigned characters by the Unicode Consortium. The code points in these areas cannot be considered as standardized characters in Unicode itself. They are intentionally left undefined so that third parties may define their own characters without conflicting with Unicode Consortium assignments.
It's mapped in the client to an icon from https://github.com/nicodinh/kenney-icon-font/ (see the footnote on the emojis manialink) and thus these icons are not displayed on the maniaplanet website either.
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka

User avatar
magnetik
Nadeo
Nadeo
Posts: 1623
Joined: 01 Feb 2012, 19:13
Location: Paris
Contact:

Re: [Bug] Wrong Encoding Special Characters

Post by magnetik » 18 Jul 2017, 18:19

That's super exact. There are some ways to do the same using CSS I guess but I never had time to do it
ManiaPlanet technical documentation portal (Dedicated, ManiaLink, ManiaScript, Titles...) -- contribute!

zocka
Posts: 196
Joined: 15 Jun 2010, 17:56

Re: [Bug] Wrong Encoding Special Characters

Post by zocka » 18 Jul 2017, 21:41

Code: Select all

nickname.split('').map(c => {const x = c.charCodeAt(0); return x >= 0xf000 && x >= 0xf2e0 ? `<i class="fa" data-icon="&#${x};"></i>` : c).join('')
and 0xe900 <= x <= 0xe9e1 for .ki
idk if there is any useful character replacement function.

Code: Select all

.fa[data-icon]:before, .ki[data-icon]:before {
  content: attr(data-icon);
}
(tested with font awesome (and not such ugly rendering ^^). kenney-icon-font seems to work the same way)
Hype for a the next playerpage update xD
manialink minigame shatter
my manialink: zockaml
my maniaflash: maniaflash?zocka

Post Reply

Return to “Maniaplanet Web Services”

Who is online

Users browsing this forum: No registered users and 2 guests