Answered

Having issues with UTF-8 names (Hebrew) in with json_encode($current_user->name)


Badge +1

The name is showing up in the Messenger in Gibberish.

I'm passing a UTF-8 string:

 

$hebrew_name = urldecode($hebrew_name);

 

Then in the messanger code, I use it like this:

 

window.intercomSettings = {

app_id: "kubohuj0",

name: <?php echo json_encode($hebrew_name) ?>, // Full name

email: <?php echo json_encode($username) ?>, // Email address

created_at: "<?php echo strtotime($current_user->created_at) ?>" // Signup date as a Unix timestamp

 };

 

I tried changing it to

json_encode($name, JSON_UNESCAPED_UNICODE) ;

 

but to no avail.

 

Any ideas?

icon

Best answer by Roy 6 June 2021, 18:21

View original

4 replies

Userlevel 1
Badge

Hello @user1140​ 👋,

 

I tried to transfer Hebrewish text to Intercom messenger via Javascript API and it's working fine:

Screenshot (2)It's seams problems coming from your server configuration.

 

Badge +1

Not sure why it's not working for me... It's kind of hard to debug because it seems like the messenger will cache the name it detects the first time, and changing the code won't help.

 

Any idea how to clear it?

Userlevel 1
Badge

@user1140​ , Actually once you update, Intercom instantly sees the change.

 

Just to troubleshoot this:

1. Go to https://jsfiddle.net/

2. Paste Intercom code for the logged-in user with Hebrewish name

3. Click Run code and see the result.

 

However, I am convinced that the problem is with the code and not with Intercom.

Hi @user1140​ 🙂

 

Our Support Engineers have confirmed that @roy s11​ 's suggestion is correct and it seems to be a configuration issue on your end.

 

Happy to look into this further if those steps don't work for you! 🔍

Reply