Visit The New, Modern Unix Linux Community

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
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:

    $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:
Test Your Knowledge in Computers #402
Difficulty: Medium
The term 3D printing originally referred to a powder bed process employing standard and custom inkjet print heads.
True or False?

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 (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
LedgerSMB::Location(3pm)				User Contributed Perl Documentation				  LedgerSMB::Location(3pm)

LedgerSMB::Location - LedgerSMB class for managing Business Locations SYOPSIS
This module contains location management routines. This subclasses LedgerSMB::DBObject to provide access to automatice mapping of function arguments and the like. METHODS
delete save Saves the location. Properties to be set to be saved are: * location_id: Optional: Overwrite location with this id. * address1: First line of the address. * address2: Second line of the address * address3: Third line of the address * city * state: state or province * zipcode: zipcode or mail code, * country: The id of the country as per the country table get Retrieves a location record based on the id field of the object. Merges the properties into the object. search Returns anarrayref (and stores it on $self->{search_results} based on the search of addresses. Not currently used. Attributes used as search criteria: address1: Partial match for address line 1 address2: Partial match for address line 2, city: Partial match for city name state: Partial match for state or province name, zipcode: Partial match for zip or postal code, country: Partial name for country name) list_all Provides a list of all locations, ordered by country, then city, then state. delete Deletes the location identified by id Copyright (C) 2007, The LedgerSMB core team. This file is licensed under the Gnu General Public License version 2, or at your option any later version. A copy of the license should have been included with your software. perl v5.14.2 2011-07-06 LedgerSMB::Location(3pm)

Featured Tech Videos

All times are GMT -4. The time now is 04:14 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy