[Bug] OpenLink() fails on Unicode characters

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

Post Reply
User avatar
m4rcel
Posts: 650
Joined: 15 Jun 2010, 11:12
Contact:

[Bug] OpenLink() fails on Unicode characters

Post by m4rcel »

When opening a Link containing Unicode characters, OpenLink() fails to properly encode the characters. It seems that they are encoded in ISO-8859 instead of the required URL-encoding.

Example ManiaLink [You have to change the path to the script at two positions in the script]:

Code: Select all

<?php

$param = htmlspecialchars(isset($_GET['param'])? $_GET['param'] : '', ENT_QUOTES, 'UTF-8');
header('Content-Type: text/xml;charset=utf-8');
echo <<<EOT
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<manialink version="1" background="0">
	<entry id="entry" name="inputParam" sizen="100 5" />
	<label id="label" posn="0 -10" style="CardButtonMediumWide" text="Send! (using ManiaScript)" ScriptEvents="1" />
	<label posn="0 -20" style="CardButtonMediumWide" text="Send! (using classic method)" manialink="http://localhost/test.php?param=inputParam" />
	<label posn="0 -30" textcolor="000F">{$param}</label>
	<script><!--
while(True) {
	foreach(Event in PendingEvents) {
		if (Event.Type == CGameManialinkScriptEvent::Type::MouseClick && Event.ControlId == "label") {
			declare Text Link = "http://localhost/test.php?param=";
			Link ^= (Page.GetFirstChild("entry") as CGameManialinkEntry).Value;
			log("OpenLink: " ^ Link);
			OpenLink(Link, ::LinkType::ManialinkBrowser);
		}
	}
	yield;
}
--></script>
</manialink>

?>
Enter something in the Entry field, using any special characters outside the ASCII code like accents, umlauts or whatever.
If you click on "Send! (using ManiaScript)", the called URL is with wrong encoding. Instead of having it urlencoded, it appears in ISO-8859-whatever.
If you click on "Send! (using classic method)", the link is called correctly, so its not a Server fault.
ImageImage
Image
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest