?
Solved

passing string to cgi from web

Posted on 2001-08-15
7
Medium Priority
?
161 Views
Last Modified: 2013-12-25
when I call cgi from my form,
sometimes string contains symbols
like this "%5C%5C%5F"
Is there easy way to convert them to the normal chars?
my cgi-script is written on c.
Thanks
0
Comment
Question by:kako
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 6

Expert Comment

by:holli
ID: 6387560
there is a module for perl. but for c? i don`t know.

anyway. you have to split the string into pieces. here 5C, 5C and 5F. These pieces are the hexadecimal values, representing the char.

eg.
5C = 92 = \
5F = 95 = _

this is the theory.

holli
0
 
LVL 8

Accepted Solution

by:
mnashadka earned 400 total points
ID: 6389158
The best way is to write a function something like:
void change_string(char *input, char *output)
{
  char c[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
  char values[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
  int i = 0, j = 0, pos = 0;
  char first_value, second_value;

  for(; i < strlen(input); ++i)
  {
    if(input[i] == '%')
    {
      first_value = toupper(input[i + 1]);
      second_value = toupper(input[i + 2]);
      i += 2;

      for(j = 0; j < 16; ++j)
      {
        if(first_value == c[j])
          first_value = values[j];
        if(second_value == c[j])
          second_value = values[j];
      }
      output[pos++] = (char)(16 * first_value + second_value);
    }
    else
      output[pos++] = input[i];
  }
}

This would be easier in C++, but I think you get the idea.  My syntax may be a little off (I don't do straight C very often), but I think you get the idea.  Hope this helps.
0
 
LVL 16

Expert Comment

by:maneshr
ID: 6654373
kako,

Did you get the solution you were looking for?

If so, please delete this question & free up your points, or award the points to the answer you found most useful.

Thanks,
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 16

Expert Comment

by:maneshr
ID: 6697219
kako,

Did you get the solution you were looking for?

What solution, if any, did you use?

If you have found the solution to this question on your own, or the question has become obsolete, please delete it & free your points.

Let us know.

Thanks.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6699401
Please update/finalize this question.

Thanks,

Moondancer
Community Support Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6827579
Administration has been contacted about the lack of responsiveness to prior follow up requests, and this information is being posted in all your open questions today.

This question appears to have been abandoned. Your options are:
 
1.  Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3.  Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4.  Delete the question. Again, you must tell the other participants why you wish to do this.

For special handling needs, please post a zero point question in the link below, include the question QID/link.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this Help Desk link for Member Guidelines, Member Agreement and the Question/Answer process:  Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues.
http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

 
PLEASE DO NOT AWARD THE POINTS TO ME.  
 
------------>  EXPERTS:
 
Please leave any comments regarding this question here on closing recommendations if this item remains inactive another three days.
 
Thank you everyone.
 
Moondancer
Moderator @ Experts Exchange
 
P.S.  For year 2000 question, special attention is needed to ensure the first correct response is awarded, since they are not in the comment date order, but rather in Member ID order.
0
 
LVL 16

Expert Comment

by:maneshr
ID: 6827731
Moondancer,

No suggestions, but points definitely not awarded to me.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question