Home |
Search |
Today's Posts |
#1
Posted to comp.lang.java.programmer,microsoft.public.excel.programming
|
|||
|
|||
How to URL-ize a string
Hi,
Sorry for the strange crosspost - I need to solve the same problem in both environments. I need to pass a string via GET to a script as the value of a parameter. My string can be arbtrary and so will have spaces, ampersands, percents, etc. So I need to replace the funny charcters with their %XX representations. Can I find a ready routine to do this and if not, is there a list of all substitutions that I need to make? Thanks! Bura |
#2
Posted to comp.lang.java.programmer,microsoft.public.excel.programming
|
|||
|
|||
How to URL-ize a string
Bura,
The spaces should be fine in a Get or Post statement, but you have to watch out for ampersands and question marks, which precede each parameter statement. The way I do this is to replace these characters with something obscure and then Post to an asp page that replaces the obscure characters with the originals before it does anything else. HTH, Robin Hammond www.enhanceddatasystems.com "Bura Tino" wrote in message ... Hi, Sorry for the strange crosspost - I need to solve the same problem in both environments. I need to pass a string via GET to a script as the value of a parameter. My string can be arbtrary and so will have spaces, ampersands, percents, etc. So I need to replace the funny charcters with their %XX representations. Can I find a ready routine to do this and if not, is there a list of all substitutions that I need to make? Thanks! Bura |
#3
Posted to comp.lang.java.programmer,microsoft.public.excel.programming
|
|||
|
|||
How to URL-ize a string
"Bura Tino" wrote in message
... Hi, Sorry for the strange crosspost - I need to solve the same problem in both environments. I need to pass a string via GET to a script as the value of a parameter. My string can be arbtrary and so will have spaces, ampersands, percents, etc. So I need to replace the funny charcters with their %XX representations. Can I find a ready routine to do this and if not, is there a list of all substitutions that I need to make? Thanks! Bura java.net.URLEncoder surprisingly. -- Tony Morris (BInfTech, Cert 3 I.T.) Software Engineer (2003 VTR1000F) Sun Certified Programmer for the Java 2 Platform (1.4) Sun Certified Developer for the Java 2 Platform |
#4
Posted to comp.lang.java.programmer,microsoft.public.excel.programming
|
|||
|
|||
How to URL-ize a string
Robin Hammond scribbled the following:
Bura, The spaces should be fine in a Get or Post statement, but you have to watch out for ampersands and question marks, which precede each parameter statement. The way I do this is to replace these characters with something obscure and then Post to an asp page that replaces the obscure characters with the originals before it does anything else. Spaces are *not* fine in a GET or POST statement. They should be encoded as + or %20. -- /-- Joona Palaste ) ------------- Finland --------\ \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/ "It sure is cool having money and chicks." - Beavis and Butt-head |
#5
Posted to comp.lang.java.programmer,microsoft.public.excel.programming
|
|||
|
|||
How to URL-ize a string
Thanks for the constructive comment. They work absolutely fine for me using
MSXML2.XMLHTTP40. Robin Hammond www.enhanceddatasystems.com "Joona I Palaste" wrote in message ... Robin Hammond scribbled the following: Bura, The spaces should be fine in a Get or Post statement, but you have to watch out for ampersands and question marks, which precede each parameter statement. The way I do this is to replace these characters with something obscure and then Post to an asp page that replaces the obscure characters with the originals before it does anything else. Spaces are *not* fine in a GET or POST statement. They should be encoded as + or %20. -- /-- Joona Palaste ) ------------- Finland --------\ \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/ "It sure is cool having money and chicks." - Beavis and Butt-head |
#6
Posted to comp.lang.java.programmer,microsoft.public.excel.programming
|
|||
|
|||
How to URL-ize a string
"Robin Hammond" wrote in message ...
Bura, The spaces should be fine in a Get or Post statement, but you have to watch out for ampersands and question marks, which precede each parameter statement. The way I do this is to replace these characters with something obscure and then Post to an asp page that replaces the obscure characters with the originals before it does anything else. Thanks. But wouldn't it be better to convert them to, say, %5C and let the server do the reverse conversions? HTH, Robin Hammond www.enhanceddatasystems.com "Bura Tino" wrote in message ... Hi, Sorry for the strange crosspost - I need to solve the same problem in both environments. I need to pass a string via GET to a script as the value of a parameter. My string can be arbtrary and so will have spaces, ampersands, percents, etc. So I need to replace the funny charcters with their %XX representations. Can I find a ready routine to do this and if not, is there a list of all substitutions that I need to make? Thanks! Bura |
#7
Posted to comp.lang.java.programmer,microsoft.public.excel.programming
|
|||
|
|||
How to URL-ize a string
Robin Hammond wrote:
Thanks for the constructive comment. They work absolutely fine for me using MSXML2.XMLHTTP40. Whatever that is. They sure aren't valid HTTP; see RFC 2396, section 2.4.3. (RFC 2616, HTTP/1.1, refers to RFC 2396 for the format of a URI). Robin Hammond www.enhanceddatasystems.com "Joona I Palaste" wrote in message ... Robin Hammond scribbled the following: Bura, The spaces should be fine in a Get or Post statement, but you have to watch out for ampersands and question marks, which precede each parameter statement. The way I do this is to replace these characters with something obscure and then Post to an asp page that replaces the obscure characters with the originals before it does anything else. Spaces are *not* fine in a GET or POST statement. They should be encoded as + or %20. -- /-- Joona Palaste ) ------------- Finland --------\ \-- http://www.helsinki.fi/~palaste --------------------- rules! --------/ "It sure is cool having money and chicks." - Beavis and Butt-head -- Chris Gray /k/ Embedded Java Solutions |
#8
Posted to comp.lang.java.programmer,microsoft.public.excel.programming
|
|||
|
|||
How to URL-ize a string
Robin Hammond wrote:
Thanks for the constructive comment. They work absolutely fine for me using MSXML2.XMLHTTP40. Perhaps that control does the encoding for you. Or perhaps you've been lucky and only interacted with servers that are very lax in violating that specific part of the HTTP specification. In the former case (and if it's actually documented behavior of the control), then you're fine. In the latter case, you should really fix this before your code starts randomly breaking on different servers. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation |
#9
Posted to comp.lang.java.programmer,microsoft.public.excel.programming
|
|||
|
|||
How to URL-ize a string
I wrote:
Robin Hammond wrote: Thanks for the constructive comment. They work absolutely fine for me using MSXML2.XMLHTTP40. Perhaps that control does the encoding for you. Or perhaps you've been lucky and only interacted with servers that are very lax in violating that specific part of the HTTP specification. In the former case (and if it's actually documented behavior of the control), then you're fine. In the latter case, you should really fix this before your code starts randomly breaking on different servers. Okay, I just checked. The documentation for the XMLHTTP control says that the second parameter to open is a URL, and mentions nothing about not needing to do encoding for illegal characters. So Robin, I'd strongly suggest you fix your code. -- www.designacourse.com The Easiest Way to Train Anyone... Anywhere. Chris Smith - Lead Software Developer/Technical Trainer MindIQ Corporation |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change 3 letter text string to a number string | Excel Discussion (Misc queries) | |||
How do I replace last numeric string from a alphanumeric string? | Excel Discussion (Misc queries) | |||
Splitting a text string into string and number | Excel Discussion (Misc queries) | |||
to search for a string and affect data if it finds the string? | Excel Worksheet Functions | |||
Create a formula into a String then assign string to a cell | Excel Programming |