Sponsored Content
Top Forums Web Development Stripping of Non-Printable Chars in the Who Is Online Page Post 303027119 by Neo on Monday 10th of December 2018 02:18:07 AM
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:
 

6 More Discussions You Might Find Interesting

1. News, Links, Events and Announcements

Usefull HP-UX Man Page Online

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 (0 Replies)
Discussion started by: killerserv
0 Replies

2. News, Links, Events and Announcements

Linux Man Page Online Link

Linux Man Page Online Link LINK: Linux Man Page Man Page for ( Section ) - The UNIX and Linux Forums (0 Replies)
Discussion started by: killerserv
0 Replies

3. Shell Programming and Scripting

How to convert C source from 8bit chars to 16bit chars?

I was using the following bash command inside the emacs compile command to search C++ source code: grep -inr --include='*.h' --include='*.cpp' '"' * | sed "/include/d" | sed "/_T/d" | sed '/^ *\/\//d' | sed '/extern/d' Emacs will then position me in the correct file and at the correct line... (0 Replies)
Discussion started by: siegfried
0 Replies

4. Shell Programming and Scripting

find 4 chars on 2nd line, 44 chars over

I know this should be simple, but I've been manning sed awk grep and find and am stupidly stumped :( I'm trying to use sed (or awk, find, etc) to find 4 characters on the second line of a file.txt 44-47 characters in. I can find lots of sed things for lines, but not characters. (4 Replies)
Discussion started by: unclecameron
4 Replies

5. Shell Programming and Scripting

removing non-printable chars from multiple files

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... (1 Reply)
Discussion started by: revax
1 Replies

6. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies
ashunt(8)							netsniff-ng-toolkit							 ashunt(8)

NAME
ashunt - Autonomous System (AS) trace route utility SYNOPSIS
ashunt -H|--host <host> -i|-d|--dev <dev> [-6|--ipv6] [-n|--numeric] [-N|--dns] [-f|--init-ttl <ttl>] [-m|--max-ttl <ttl>] [-q|--num-probes] [-x|--timeout <sec>] [-S|--syn] [-A|--ack] [-F|--fin] [-P|--psh] [-U|--urg] [-R|--rst] [-E|--ecn-syn] [-t|--tos <tos>] [-G|--nofrag] [-X|--payload <string>] [-Z|--show-packet] [-l|--totlen <len>] [-w|--whois <server>] [-W|--wport <port>] [--city-db <path>] [--country-db <path>] [-v|--version] [-h|--help] DESCRIPTION
This program provides AS information on each hop between the client and the target host. OPTIONS
ashunt -i eth0 -N -E -H netsniff-ng.org IPv4 trace of AS with TCP ECN SYN probe ashunt -i eth0 -N -S -H netsniff-ng.org IPv4 trace of AS with TCP SYN probe ashunt -i eth0 -N -F -H netsniff-ng.org IPv4 trace of AS with TCP FIN probe ashunt -i eth0 -N -FPU -H netsniff-ng.org IPv4 trace of AS with Xmas probe ashunt -i eth0 -N -H netsniff-ng.org -X "censor-me" -Z IPv4 trace of AS with Null probe with ASCII payload ashunt -6 -S -i eth0 -H netsniff-ng.org IPv6 trace of AS up to netsniff-ng.org OPTIONS
-h|--help Print help text and lists all options. -v|--version Print version. -H|--host <host> Host/IPv4/IPv6 to lookup AS route to i-|-d|--dev <netdev> Networking device, i.e. eth0 -p|--port <port> Hosts port to lookup AS route to -4|--ipv4 Use IPv4 requests (default) -6|--ipv6 Use IPv6 requests -n|--numeric Do not do reverse DNS lookup for hops -N|--dns Do a reverse DNS lookup for hops -f|--init-ttl <ttl> Set initial TTL -m|--max-ttl <ttl> Set maximum TTL (default: 30) -q|--num-probes <num> Number of max probes for each hop (default: 3) -x|--timeout <sec> Probe response timeout in sec (default: 3) -S|--syn Set TCP SYN flag in packets -A|--ack Set TCP ACK flag in packets -F|--fin Set TCP FIN flag in packets -P|--psh Set TCP PSH flag in packets -U|--urg Set TCP URG flag in packets -R|--rst Set TCP RST flag in packets -E|--ecn-syn Send ECN SYN packets (RFC3168) -t|--tos <tos> Set the IP TOS field -w|--whois <server> Use a different AS whois DB server (default: /etc/netsniff-ng/whois.conf) -W|--wport <port> Use a different port to AS whois server (default: /etc/netsniff-ng/whois.conf) --city-db <path> Specifiy path for geoip city database --country-db <path> Specifiy path for geoip country database AUTHOR
Written by Daniel Borkmann <daniel@netsniff-ng.org> DOCUMENTATION
Documentation by Emmanuel Roullit <emmanuel@netsniff-ng.org> BUGS
Please report bugs to <bugs@netsniff-ng.org> 2012-06-29 ashunt(8)
All times are GMT -4. The time now is 05:23 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy