NODE
I am working with an API and occasionally people have imbedded formatting codes into the text of a description which is causing an error when saving to a database field
The field is called description and is of Type ‘Text.’
Occasionally i get an error when doing a database insert like this
I believe hex code E280AF is UTF-8 for “Narrow no-break space”
I have tried to remove it with
description.replace(’\xE2\x80\xAF’, ‘’)
description.replace(‘E280AF’, ‘’)
description.replace(‘xE2x80xAF’, ‘’)
but without any luck, anyone any ideas please
@Teodor
Think i may have found the issue.
This is a fairly old system and although the database is showing UTF8 some of the tables are still set to Latin1 which i guess was a pervious setting. Just updating table Charsets and will let you know
1 Like
Just curious where the Narrow no-break space
is coming from, do you have an html editor in the form that posts the data for the insert?
Firstly converting table to UTF8 cured the issue, sorry to have bothered you
The data comes from a property agents API which i use to update records in the site’s database on a daily basis
The “Narrow no break space” hex code is coming in as part of the description text fed from the API. I am assuming some of the agents who update the central API are pasting it in as part of the description text.