Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

getAuthenticationToken() in afcs.php

Avatar

Former Community Member

Hi guys,

what is the reason to utf8_encode the name in the last version?

$token = "x:{utf8_encode($name)}::{$this->account}:{$id}:{$this->room}:{$role}";

utf8_encode($name)

- There is no need to do this if the file itself is UTF-8 encoded.

- Does only function for ISO encoded files.

- It produces errors with lets say german umlauts ö,ä,ü in usernames.

Please remove it or suggest me a workaround.

Thanks in advice.

George.

2 Replies

Avatar

Employee

User names on the server-side are expected/processed as utf-8 encoded and another developer complained that non-utf-8 encoded names where giving him an error.

So, what's the right solutions ? Maybe I should just check if I like the encoding and throw an error otherwise.

Avatar

Level 1

This was actually an issue for me to - I was actually having "{utf8_encode(whatevername)}" appear in my App as the username passed through the token. I had to hack afcs.php to something like:

$displayname = utf8_encode($name);

$token = "x:{$displayname}::{$this->account}:{$id}:{$this->room}:{$role}";

-Kevan