25
Views
4
Comments
how to remove [U+202A] left tor right in text
Question

Hi guru's!

I have a strange problem, I copied some text to a input field and saved in the database. Now when I use the value in api call I get a error back. When I copy the value that is stored in the database to for example visual studio I see there is strange code in the text: [U+202A].

How can we remove this from the string when sending it to the API?

Kind regards.



2019-04-09 00-57-55
carl ruhle

Hi,

you will have to create a function that removes non ascii values from the string, what I mean is that you will have to create a new variable with only ascii values. 

UserImage.jpg
freek

any tips on how to do that?

UserImage.jpg
freek

Probably I can do something with regex replace(/[^\x00-\x7F]/g, "");

Do I then need to put this function on everything that I put in the database?!

UserImage.jpg
freek

I fixed it for now by do a regex_replace with pattern [ˆ\d+] I will create a new post for my question about preventing it storing in the database.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.