|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Hello there,
Here i have a code which accepts data from an html page. The user inputs like "a & b " in the edit box is read as "a %26 b " and so on. How can i read the input as " a & b" itself. When i use the following function $content=~ tr/%(..)/pack("c",hex($1))/; I am getting "a p26 b " as output for the input "a & b". Could u please suggest some solution for my problem. Will any other arguments for pack function solve the problem. Thanks in advance. Dups |
|
#2
|
|||
|
|||
|
Look for a function or extension that deals with URL encoding. I think that sort of thing is covered in Programming CGI with Perl by O'Reilly. I am sure there are also some online.
Also, it may not be working because you are using pack wrong for that type of conversion. You are dealing with Hex, as you seem to be aware of so the first argument to pack should be ["H*"]. The H indicates a hex string, high nibble first. The star is there in place of a number which can be specified as a repeat count. If there were a number, pack would convert as many values from the list as the number specified. The star tells pack to go all the way through. So, after all that the code that you would need to do that sort of pack would be: Code:
$char = pack "H*", "26"; In your case, i tried using it in a regular expression to see if it work(had a hunch it wouldn't) and it did not. Hope some of this helps.
__________________
- dsb - ![]() Perl Guy |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > regarding pack function |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|