0

I am retrieving data from database which has special character §, When I set debugger on API, I see the value is with same character. I am sending back the response.

        public async Task<IActionResult> Get()
        {
            var retVal = ...
            return Json(retVal);
        }

Now on the browser when I check the network call i see on the response value coming as \u00A761 . And on UI it is displayed as
enter image description here Looks like its not able to encode the character properly.
I have meta tag on head section also

<meta charset="utf-8">

Any Idea what I might be missing?

Amir
  • 1,855
  • 3
  • 24
  • 40
  • 2
    Seems like angular is not rendering the character correctly. Not my area of expertise, but posting the angular code would likely help. I did some research out of curiosity, and found a number of posts regarding displaying unicode character in angular bindings not working, worth looking into. – hijinxbassist Aug 12 '22 at 00:21
  • @hijinxbassist, you are right, i went on wrong direction, yes it was angular binding which was not working. I took help from this post https://stackoverflow.com/questions/31548311/angular-html-binding/41089093#41089093
    Thanks
    – Amir Aug 12 '22 at 14:11
  • Note that only the `\u00a7` part is §. Basically, JSON of `\u00a761` represents text of §61. – Jon Skeet Apr 24 '23 at 07:24

1 Answers1

-1
 var retVal = @"\u00A761";

 string output = Regex.Unescape(retVal);
Adriaan
  • 17,741
  • 7
  • 42
  • 75
  • 1
    Please read [answer] and [edit] your answer to contain an explanation as to why this code would actually solve the problem at hand. Always remember that you're not only solving the problem, but are also educating the OP and any future readers of this post. – Adriaan Apr 24 '23 at 07:37