Remove nbsp from the line

Hello. I got a project on CodeInteger here. There is a string in the database (the name of the product category, for example). In the output, &nbsp is inserted instead of a space. What I have just not tried: str_replace, preg_replace etc. But it still remains! In the database, the usual space. Please tell me where it can come from and how to get rid of it?

This needs to be fixed so that there is a newline transfer:
screenshot

UPDATE:
It is not added to the line in English. There's a regular one whitespace. Something with the encoding

Author: VenZell, 2013-09-05

6 answers

I also searched for an answer to this question for a long time, in my case this design helped, it may be useful to someone.

$text = htmlentities($text);
$text = str_replace(" ",'',text);
 3
Author: SunwelLight, 2015-06-11 08:17:56

As always, you suffer-you suffer and as soon as you ask, you find the answer yourself. I rewritten the lines in the database with the handles and everything became as it should be. MySQL Workbench means too &nbsp as the space bar shows.
Most likely, when adding htmlspecialchars from the admin panel, they are already flying in the database instead of spaces.

 1
Author: Ray, 2013-09-05 10:38:36
$text = html_entity_decode($text);
 1
Author: Serhiy Zhovnir, 2016-08-08 11:26:19
$text = htmlspecialchars_decode($text);
 0
Author: dlarchikov, 2013-09-05 10:26:36

In the output, a space is inserted instead of a space. But it still remains! In the database, the usual space.

The decimal non-breaking space code is 160, the hexadecimal code is 0xA0. It is this character that should be replaced.

And the mnemonic   appears, most likely, already during the formation of the markup.

 0
Author: Qwertiy, 2015-06-05 20:31:41

So shorter:

str_replace(chr(160), ' ', html_entity_decode($string))
 -1
Author: Никита, 2018-04-18 18:45:50