Open Closed

Turkish characters are shown as HTML entities in role names (e.g., ö, ç) #9524


User avatar
0
IbrahimSarigoz created

Hello,

In our project role names that include Turkish characters such as "ç", "ö", "ı" are shown in the UI as HTML entities (e.g., ç, ö).

Example: The role name "Bahçıvan" appears as Bahçıvan in the role assignment modal.

But in the Roles page it looks like fine.

How can we solve this problem? Thanks.


9 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • The issue occurs because the role names are being HTML-encoded twice or not properly decoded before rendering in the modal. This is why Turkish characters like "ç" and "ö" appear as HTML entities (e.g., ç, ö) in the modal, but display correctly elsewhere.

    • In ABP MVC applications, Razor automatically encodes output to prevent XSS. If your data is already HTML-encoded before being passed to the view, it will be encoded again, resulting in the display of HTML entities.

    • To fix this, ensure that:

      1. Role names are stored and retrieved as plain Unicode strings (not HTML-encoded) in your database and backend.
      2. In your Razor view, use @Html.Raw(roleName) only if you are 100% sure the data is safe and not user-supplied, otherwise just use @roleName (the default).
    • If you are using a custom modal or JavaScript to render the role names, make sure you are not encoding the names twice (e.g., once on the server and once on the client).

    Example Razor usage:

    @* Correct: roleName is plain text, Razor encodes it automatically *@
    <span>@roleName</span>
    
    @* If you must decode HTML entities (not recommended for user input): *@
    <span>@Html.Raw(roleName)</span>
    
    • Review your backend and frontend code to ensure you are not manually encoding the role names before passing them to the view or JavaScript.

    • For more on Razor Tag Helpers and encoding, see:

      • https://abp.io/docs/en/abp/latest/UI/AspNetCore/Tag-Helpers

    Summary:
    Store and handle role names as plain Unicode strings, let Razor handle encoding, and avoid double-encoding in your backend or JavaScript. Use @roleName in Razor unless you have a specific reason to use @Html.Raw.

    • Validated source:
      • https://abp.io/docs/en/abp/latest/UI/AspNetCore/Tag-Helpers

    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    IbrahimSarigoz created

    However, in our case, we are using the built-in Identity module, and we did not implement the role listing or role assignment modal manually.

    We are not manually encoding the data anywhere. Yet, Turkish characters such as "ç", "ö", "ı" are displayed in the Assign Roles Modal as HTML entities like ç, ö, etc.

  • User Avatar
    1
    maliming created
    Support Team Fullstack Developer

    hi

    I will check it and provide a solution.

    Thanks

  • User Avatar
    0
    alper created
    Support Team Director

    I also produced the problem

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Yes, I have fixed it, It will be available in next 9.2 patch version.

  • User Avatar
    0
    IbrahimSarigoz created

    Thanks for the update. Do you have an estimated release date for the 9.2 patch version?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    I think it will be released within two weeks.

    You can override the EditUser page. If you need the page source code, You can send an email liming.ma@volosoft.com

    Thanks.

  • User Avatar
    0
    IbrahimSarigoz created

    Hi,

    Thank you for your helpful response regarding the EditUser page.

    I just wanted to kindly let you know that the same issue also exists on the CreateUser page. If this hasn't been noticed yet, it might be worth reviewing and applying the same fix there as well.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Thanks. I have fixed it on the Create page. : )

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on July 11, 2025, 11:35