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)
-
0
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:
- Role names are stored and retrieved as plain Unicode strings (not HTML-encoded) in your database and backend.
- 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.
-
0
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.
-
1
hi
I will check it and provide a solution.
Thanks
-
0
-
0
Yes, I have fixed it, It will be available in next 9.2 patch version.
-
0
Thanks for the update. Do you have an estimated release date for the 9.2 patch version?
-
0
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.comThanks.
-
0
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.
-
0
Thanks. I have fixed it on the Create page. : )