Trying to query microsoft defender for office 365 tenant that is written in Japanese characters but erroring out.

Mark Noble 0 Reputation points
2025-07-28T12:32:31.3433333+00:00

Trying to query microsoft defender for office 365 tenant that is written in Japanese characters but erroring out.

Am I able to query non ASCII characters via the defender for o365 API?

Microsoft 365 and Office | Microsoft 365 Defender | Other | Other
{count} votes

1 answer

Sort by: Most helpful
  1. Alex_T 3,590 Reputation points Microsoft External Staff Moderator
    2025-07-28T17:17:03.7766667+00:00

    Hi Mark,

    Welcome to Microsoft Q&A.

    I understand how tricky it can be when working with international character sets in APIs.

    To answer your question directly: Yes, the Microsoft Defender and Microsoft Graph APIs absolutely support non-ASCII (Unicode) characters, including Japanese.

    The errors you're encountering are almost always related to how those characters are encoded in the API request itself, rather than a lack of support from the service.

    1. If the Japanese characters are in the URL's query string (for example, in a $filter parameter), they must be properly URL-encoded (also called percent-encoding). Most modern scripting languages and tools (like Python's requests library or PowerShell's Invoke-RestMethod) do this automatically. However, if you are building the URL string manually, you need to ensure the non-ASCII characters are encoded first.
    2. If the characters are in the JSON body of a POST request, make sure your Content-Type header correctly specifies the UTF-8 charset: Content-Type: application/json; charset=utf-8
    3. If you're running a PowerShell or Python script, for instance, ensure the .ps1 or .py file is saved with UTF-8 encoding, not ASCII. Otherwise, the characters can be corrupted before they are even sent.

     Let me know if you need further assistance.

    Best regards,

    Alex | Microsoft Q&A Support Specialist

    ------------------------------------------------------------------------------------------------------------ 

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. 

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.