Encoding Issues in B2C Custom Policies

Teun Dozeman 25 Reputation points
2023-05-31T11:36:41.95+00:00

We are facing encoding issues in our B2C custom policies, even after updating all ContentDefinition DataUri to the latest templates. The problems arise in the signinup and password reset custom policies, where characters like "ä" are not rendering correctly. Also each XML file is provided with the encoding="utf-8".

Upon token verification in the signinup functionality, an email is sent, and upon opening the window for entering the two passwords, I noticed that the HTML page contains the UTF-8 meta tag for encoding. However, when inspecting the body of the received HTML page via the Chrome debugbar, I observed that the encoding issue is already present. Instead of rendering the "ä" character, it displays a weird question mark symbol.

Additionally, I noticed a change in the URL structure during this process. The URL changes from "B2C_1A_SignInUp/api/SelfAsserted/unified" to "B2C_1A_SignInUp/api/SelfAsserted/confirmed." I suspect that this URL change might be related to a template switch, possibly causing the encoding issue.

I would greatly appreciate any insights or solutions to resolve this encoding problem in my B2C custom policies. Thank you in advance for your assistance.

Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
798 questions
Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,656 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,601 questions
{count} votes

Accepted answer
  1. Shweta Mathur 27,786 Reputation points Microsoft Employee
    2023-06-01T12:08:39.1466667+00:00

    Hi @Teun Dozeman ,

    Thanks for reaching out.

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others", I'll repost your solution in case you'd like to "Accept" the answer.

    User's image

    For such issues, It is important to ensure consistency in encoding declaration is present in all relevant XML files, from the creation and modification of policy shell scripts to their deployment. By explicitly specifying UTF-8 encoding where necessary, you can avoid rendering issues with special characters and ensure proper handling of text data.

    Thanks,

    Shweta

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Teun Dozeman 25 Reputation points
    2023-06-01T09:52:40.7066667+00:00

    The issue was in the deploy/building pipeline scripts. When reading the XML files and sending i forced everywhere to use UTF-8 encoding since i think the default is ASCII. This fixed the issue for me

    1 person found this answer helpful.
    0 comments No comments