homepage Welcome to WebmasterWorld Guest from 54.167.238.60
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
safe characters
smallcompany




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

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




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

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




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

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




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

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




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

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




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

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




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

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




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

I'll try make it simple:

Why "-" does not get encoded?

Thanks

lavazza




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

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

smallcompany




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

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?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved