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


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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:
# 2  
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-112858-pmpng
This User Gave Thanks to Neo For This Post:
Login or Register to Reply

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

More UNIX and Linux Forum Topics You Might Find Helpful
removing non-printable chars from multiple files
revax
How do I remove non-printable characters from all txt files and output the results to one file? I've tried the following: tr -cd '\n' < *.txt > out.txt and it gives ambiguous redirect error. How can I get it to operate on all txt files in the current directory and append the output to...... Shell Programming and Scripting
1
Shell Programming and Scripting
Linux Man Page Online Link
killerserv
Linux Man Page Online Link LINK: Linux Man Page Man Page for ( Section ) - The UNIX and Linux Forums... News, Links, Events and Announcements
0
News, Links, Events and Announcements
Usefull HP-UX Man Page Online
killerserv
Usefull HP-UX Man Page Online Link LINK: HP-UX Man Page http://www.doc.ic.ac.uk/~mac/manuals/hpux-manual-pages/hpux.man1.html... News, Links, Events and Announcements
0
News, Links, Events and Announcements

Featured Tech Videos