The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 19, 2019, 01:47:57 PM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: fishing windows  (Read 1671 times)
serialnoob
Journeyman
***
Offline Offline

Posts: 88


View Profile
« on: November 30, 2008, 07:33:05 PM »

source [http://php.net/manual/en/function.chr.php#85050]

I have spent hours figuring out how to handle this one, as it happens the 139 and 155 chr translation were originally  written with single quotes
and it seems the file should be included separately to work ok, at least in my case

Code:
function sas_cleanup1($str)
{
$str = str_replace(chr(130), ',', $str);
$str = str_replace(chr(131), 'NLG', $str);
$str = str_replace(chr(132), '"', $str);
$str = str_replace(chr(133), '...', $str);
$str = str_replace(chr(134), '**', $str);
$str = str_replace(chr(135), '***', $str);
$str = str_replace(chr(136), '^', $str);
$str = str_replace(chr(137), 'o/oo', $str);
$str = str_replace(chr(138), 'Sh', $str);
$str = str_replace(chr(139), "<", $str);
$str = str_replace(chr(140), 'OE', $str);
$str = str_replace(chr(145), "'", $str);
$str = str_replace(chr(146), "'", $str);
$str = str_replace(chr(147), '"', $str);
$str = str_replace(chr(148), '"', $str);
$str = str_replace(chr(149), '-', $str);
$str = str_replace(chr(150), '-', $str);
$str = str_replace(chr(151), '--', $str);
$str = str_replace(chr(152), '~', $str);
$str = str_replace(chr(153), '(TM)', $str);
$str = str_replace(chr(154), 'sh', $str);
$str = str_replace(chr(155), ">", $str);
$str = str_replace(chr(156), 'oe', $str);
$str = str_replace(chr(159), 'Y', $str);
return $str;
}


Probably not very streamlined but it does the job, at least for me now. if any one has a smart solution for this, the situation is as follows, I was db uploading sas stuff to build catalogs only to discover that I still had a lot of cleanup to do. Eventually I turned to this solution which worked fine, when outputing. Obviously not the wisest one , Ill have to do it when uploading rather etc. I realized this was  bugging when then testing if everything worked together with my cj import side. Hence the separate file solution as an include/require. I am so much not an expert that I am clueless re alternate solutions... anyway, my 2ct, well, may be less
Logged

Success consists of going from failure to failure without loss of enthusiasm - Winston Churchill
perkiset
Olde World Hacker
Administrator
Lifer
*****
Offline Offline

Posts: 10096



View Profile
« Reply #1 on: December 03, 2008, 11:01:05 PM »

At the very least you should create an array for parms 1 and 2, which will cut the cost of this function down considerably.

Other than that, it's about as tight as you can get.
Logged

It is now believed, that after having lived in one compound with 3 wives and never leaving the house for 5 years, Bin Laden called the U.S. Navy Seals himself.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!