Skip to content

Special Characters in Summoner Name not working #51

@StreakyCat

Description

@StreakyCat

Using the getSummonerId with summoner names that contain special characters (á,é,î,ô,ý...)
results in NOT FOUND. A fix would be:

$query = "Summoner name with special chars á,é,î,ô,ý" ;
$query = utf8_decode($query) ;

Now you can safely pass your $query to getSummonerId($query):

function getSummonerId($query)
{
    global $api;

    try 
    {
        $r = $api->getSummonerId($sum_name);
        return json2array($r);
    } 
    catch(Exception $e) 
    {
        echo "Error: " . $e->getMessage();
        return null;
    };
}

Inside your php-riot-api.php you have to modify $call inside function getSummonerByName($name):

public function getSummonerByName($name)
{   
    //OLD $call = 'summoner/by-name/' .  rawurlencode($name);
    $call = 'summoner/by-name/' . rawurlencode(utf8_encode($name));

    //add API URL to the call
    $call = self::API_URL_1_4 . $call;

    return $this->request($call);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions