Unable to Find Users by Email Due to Invisible Unicode Characters in Email Address

Overview

This article explains why searching for a user by email address via the /api/v2/users-by-email or /api/v2/users endpoints or the admin portal fails. However, the user returns when searching by username or user_id fields via the /api/v2/users endpoint.

Applies To
  • Users
  • Username
  • Email
Cause

The email address contains invisible Unicode characters (e.g., `\u2060`, WORD JOINER, A zero-width non-breaking space).
These invisible characters are not supposed to be displayed, just like their names suggest. Although they look the same, searching for an email address without the invisible character does not match the actual email address, so the user's search by email does not return any results.

Solution

Do not create users with invisible Unicode characters. Search users by user_id, username, nickname, phone number, or any other fields that do not contain invisible characters.

Follow the steps below to identify if there are invisible Unicode characters in the user's email or any other fields in the profile. 
There are a few ways to identify the invisible Unicode characters in the email address.
First, find the user by user_id (or username, nickname, phone number, or any other field that does not contain an invisible character). 

  1. Select the Raw JSON tab. 
  2. Click COPY JSON button to copy the user profile in JSON format.

Second, use any of the following tools to check if there are invisible Unicode characters in the user profile:

  • VS Code highlights the invisible Unicode characters by default.
  // Controls whether characters that just reserve space or have no width at all are highlighted.
  "editor.unicodeHighlight.invisibleCharacters": true,

Recommended content

No recommended content found...