Welcome to WebmasterWorld Guest from 54.226.130.194

Forum Moderators: incrediBILL

Message Too Old, No Replies

safe characters

     

smallcompany

8:02 am on Apr 25, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



I pass the variables through PHP scripts and I get them as my IDs in affiliate sales reports.

In order to divide sub-variables, I use "-" character. But the hyphen is already used in many domain names which I have as referring sites.
"+" is already used instead of space in search queries.

I wonder what are the other safe characters that could be used here.

I searched the web about "safe" and "escape" but did not find a definite information.

I need something that I can use in Excel to do "text to columns" while preserving information intact. Right now I have to fix it manually wherever the hyphen has already been used in domain names or search queries.

Thanks

rocknbil

6:08 pm on Apr 25, 2010 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



This is actually a "frequent flier" - for example, in the context of exporting a database to a delimited text file, they style of quoting you use can create issues.

First, what do you mean "safe?" While cleansing user input, agreed, there are a variety of characters you don't want to allow (or, data that is not characters, or groups of characters that can be nasty, like <script.*>.)

But when you internally generate characters from your script and can control what is done with them, the data can be trusted. So really, you should be able to use anything you want, as long as it doesn't conflict with the strings you're working with.

The pipe character | is a pretty good one, or the circumflex caret ^, or the tilde ~.

When importing into into Excel, you'll have to look for and SET the delimiting character to whatever you decide to use.

lavazza

7:17 pm on Apr 25, 2010 (gmt 0)

5+ Year Member



I need something that I can use in Excel to do "text to columns" while preserving information intact.
How about commas?

It's unlikely that they're used in variable names

And they're what's used to separate values in CSV files [google.com], which are ideal for Excel

smallcompany

4:52 am on Apr 27, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Thanks to all.

First, what do you mean "safe?"

Safe so it gets passed to reporting system unchanged. It should be a brother or sister to A-Z, 0-9, plus, minus.

How about commas?

I believe I saw comas and periods listed somewhere. Comas should do it as I don't recall seeing them in my variable strings at all. I need something unique.

smallcompany

5:47 am on Apr 28, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Well, I see that my comas have become %2C

So that was not "safe". If I put "+" or "-", they both go through unchanged. Why "," got changed?

Thanks

lavazza

6:37 am on Apr 28, 2010 (gmt 0)

5+ Year Member



You said
I need something that I can use in Excel to do "text to columns" while preserving information intact.


My suggestion of CSV files was meant as an intermediary step


Apologies in advance if the following is a case of 'teaching Grandma to suck eggs'


If you copy the Lorem,ipsum,dolor,sit,amet, guff below into a text editor and save it as myTest.csv and then close the file and then re-open the file with Excel, the 108 words will be in 9 columns and 12 rows

:)


Lorem,ipsum,dolor,sit,amet,consectetuer,adipiscing,elit,ipsum
Donec,in,purus,a,dui,venenatis,laoreet,Integer,faucibus
convallis,urna,Maecenas,iaculis,justo,non,leo,Duis,eget
tortor,eu,dui,dapibus,sagittis,Integer,nec,diam,Maecenas
tristique,auctor,ligula,In,egestas,Nunc,interdum,magna,id
felis,Sed,hendrerit,nunc,non,quam,In,fringilla,erat
In,vitae,nulla,congue,mauris,fringilla,iaculis,Sed,gravida
tellus,eget,purus,Sed,pulvinar,aliquam,turpis,Curabitur,ipsum
metus,magna,pretium,ac,egestas,in,bibendum,sit,amet
pede,Proin,tristique,Curabitur,fringilla,euismod,libero,ipsum,ipsum
Aenean,pulvinar,massa,vitae,sodales,rutrum,nunc,dui,ipsum
adipiscing,enim,in,aliquam,lacus,urna,id,tellus,Quisque

smallcompany

6:43 am on Apr 28, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



I pass the variables through PHP scripts and I get them as my IDs in affiliate sales reports.


Then I export reports into the Excel.

smallcompany

1:59 am on Apr 30, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



I'll try make it simple:

Why "-" does not get encoded?

Thanks

lavazza

2:29 am on Apr 30, 2010 (gmt 0)

5+ Year Member



Please explain what you mean by "divide sub-variables"

smallcompany

4:56 am on Apr 30, 2010 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



With PHP I grab referring URL, search query, and anything else I want to pass through.

Then I do this:

$end = "$v1-$v2-$v2";

So I get my variables in the reporting as V1-V2-V3

The problem is that "-" is sometimes a part of some of the variables.

So I was looking for another character that could replace "-".

I know that "+" is already being used to fill in the blanks for space, and therefore I cannot use + sign.

Is there anything besides "+" and "-" that does not get encoded?