Stripping of Non-Printable Chars in the Who Is Online Page

Noticed that after changing our site and HTML be to UTF-8 compliant per HTML5 standards, we started to see unprintable chars in the country and city name from the geoip database which converts IP addresses to country and city names. So, I just added this code to that PHP plugin which seems to do the trick:

if($record->city){ 
    $clean = preg_replace('/[\x00-\x1F\x7F]/u', '', $record->city . ", " . $record->country_name); 
     $userinfo['geoip_country_name'] = $clean; 
  } 
else { 
    $clean = preg_replace('/[\x00-\x1F\x7F]/u', '', $record->country_name); 
    $userinfo['geoip_country_name'] = $clean; 
  } 

I did a check and seems that problem has been solved, or at least a bandaid fix to another issue I don't have time to look into at this time.

1 Like

TODO:

Do the same for the "who is currently online" bits on the home page.

1 Like