PHP How to remove / replace Unknown question mark characters

I use PHP to access and output data on older machines.

Putty shows:

β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’
β–’NONE.
β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’β–’

Its weird formatting in an attempt to show data in a cleaner way

PHP echo chrome shows:

      
 NONE.  
      

I tried:

$Str1 = str_replace("β–’","",$Str1);

But he does not filter them out. The output is already utf 8.

Does anyone know how to filter these things out? Maybe determine what for php?

+6
source share
1 answer

Try it:

$Str1 = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '', $Str1);
+12
source

Source: https://habr.com/ru/post/1686799/


All Articles