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

Tags
geoip, geoip_country_name, utf-8 character replacement, web programming

 
Thread Tools Search this Thread
# 1  
Old 12-10-2018
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:

Code:
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.
This User Gave Thanks to Neo For This Post:
000vikas (12-15-2018)
# 2  
Old 12-14-2018
TODO:

Do the same for the "who is currently online" bits on the home page.
Stripping of Non-Printable Chars in the Who Is Online Page-screen-shot-2018-12-14-11-28-58-pm-png
This User Gave Thanks to Neo For This Post:
000vikas (12-15-2018)

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
removing non printable characters pandeesh UNIX for Dummies Questions & Answers 2 12-19-2011 04:56 AM
Non-printable characters Joy Conner HP-UX 3 03-10-2010 12:10 PM
removing non-printable chars from multiple files revax Shell Programming and Scripting 1 01-19-2009 11:18 AM
find 4 chars on 2nd line, 44 chars over unclecameron Shell Programming and Scripting 4 11-06-2008 02:47 PM
grep non printable characters ripat Shell Programming and Scripting 3 06-23-2008 08:25 AM
How to convert C source from 8bit chars to 16bit chars? siegfried Shell Programming and Scripting 0 09-26-2007 03:26 PM
Linux Man Page Online Link killerserv News, Links, Events and Announcements 0 02-27-2002 10:37 PM
Usefull HP-UX Man Page Online killerserv News, Links, Events and Announcements 0 02-26-2002 10:06 PM