3

i have in database a string written with degree symbol, problem is when im printing it im getting it with unicode, each unicode is different even they are the same symbol, its driving me crazy how can replace the degree symbol for white space, im doing it this way:

 foreach ($video as $desc) {
          if (preg_match('/\/(.*?)"E/', $desc, $match) == 1) {
                $test = preg_replace('/[^\x20-\x7E]/', '', $match[1]);
                echo $test;
            }
         }

and my output is:

22\u00b017'44.1\"N, 114\u00b010'07.7\ 
22\u00b016'55.5\"N, 114\u00b009'16.9\
22\u00b018'50.6\"N, 114\u00b013'00.5\ 
22\u00b017'14.4\"N, 114\u00b009'04.0\
22\u00b023'16.3\"N, 114\u00b011'05.5\
22\u00b018'48.3\"N 114\u00b013'28.6\

each \u00b017 is the degree symbol printed in postman, but i dont want them, cant remove it or replace it since each one of them are different, theres no way i can set it manually

lol69
  • 121
  • 3

1 Answers1

1

The degree symbol is \u00b0. You can use str_replace instead of RegEx to remove it:

str_replace('\u00b0', '', $test);
Skip
  • 95
  • 8