473,595 Members | 2,589 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem in href url encoding

rajiv07
141 New Member
Expand|Select|Wrap|Line Numbers
  1. $cEn_com =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
  2.  
  3. $cEn_art =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
  4.  
  5. $cResult .= "<a href=javascript:open1('/cgi-bin/admin/order_details.pl?ordernumber=ordernum&artist=$cEn_art&company=$cEn_com');>click</a>";
  6.  
Here i have send the encoded parameter with url to javascript open1 function
to diaplay popup window.The open1 function that i am placing in head tag in my html file.

here what my problem is when any one of parameters ( $cEn_com and $cEn_art) has some value the output (OUTPUT is click) is display.If the values are empty string nothing get display.

Is any Idea.
Thank U.
Aug 10 '07 #1
2 1619
crabpot8
40 New Member
i am not entirely sure of your problem, but you could always make sure there was some output, like this

Expand|Select|Wrap|Line Numbers
  1.  if ($cEn_art !~ m{[a-z]}ig || $cEn_com !~ m{[a-z]}ig) {
  2.     #create default response here
  3.  
hope that helps
Aug 11 '07 #2
miller
1,089 Recognized Expert Top Contributor
There does not appear to be anything wrong with your encoding. However, I would advise you to use the standard module for this type of escaping. It not only helps document what you are trying to do better, but is actually faster sinceu it caches both the replacement translation but also the pattern that you choose to escape:

cpan URI::Escape

Expand|Select|Wrap|Line Numbers
  1. use URI::Escape;
  2.  
  3. $cEn_com = uri_escape($cEn_com, '\W');
  4. $cEn_art = uri_escape($cEn_art, '\W');
  5.  
  6. $cResult .= qq{<a href="javascript:open1('/cgi-bin/admin/order_details.pl?ordernumber=ordernum&artist=$cEn_art&company=$cEn_com');">click</a>};
  7.  
Also, I would advice you to always quote your href's.

Anyway, your problem is not directly related to perl, but is actually either an html or javascript issue. I advise you to ask in the JavaScript forum if the simple quoting of the href above does not fix your problem.

- Miller
Aug 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3291
by: CES | last post by:
All, Could someone please look at this and tell me what's wrong... the function works properly in FireFox but in IE onmouseover it replaces the innerHTML. So the original html: at info@test.com Thank you for your consideration. becomes at mailto:info@test.com:?SUBJECT=Request for additional information - Package id : /*JS var*/ Thank you for your consideration.
7
2844
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID parameter to the XSLT stylesheet XsltArgumentList xsltArgList = new XsltArgumentList(); xsltArgList.AddParam("pmID", "", pmID); xmlItems.TransformArgumentList = xsltArgList;
0
1049
by: mirek | last post by:
Hello people, my SOAP client in C# generates this SOAP call <?xml version="1.0" encoding="utf-8" ?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:anima:partner" xmlns:types="urn:anima:partner/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
2746
by: yqlu | last post by:
I hava developed a client in C# that is connected to a 3-party XML Web Services developed in Java based on the AXIS 1.1. Most methods call are successful except for one method named "findObjects" and return a complex type "FieldSearchResult". The error message as following : "Cannot assign object of type System.String to an object of type System.String. There is an error in XML document (23, 97)." By the way,I hava written a client in Java...
0
1931
by: helldiversafe-news | last post by:
Hi all, I will use a apache soap service with an .net c# client and have a problem with an complex array: <?xml version='1.0' encoding='UTF-8'?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <SOAP-ENV:Body>
102
6751
by: hug | last post by:
www.webmaster, was suggested that this ng could be a better place.] I've updated my test server to handle if-modified-since. I've noticed that the (old copies I run of) IE and Netscape seem never to send if-modified-since. But the strange thing is that Opera sends if-modified-since but when I reply with "HTTP/1.0 304 Not Modified" it is not refreshing the screen from its cache, it is leaving the screen blank.
1
1627
by: virajitha | last post by:
Hi .... I am facing a major problem in writing a javascript that will load an xml document dynamically and posts it to the next page when clicked on a hyperlink. The problem is that in the below code i am not able to create the fso object . I called five alert statements alternatley. when I load the html page i call this function hello in the body tag with onload event. when the page loads i get only 3 msg boxes and no message box appears...
2
1272
jlrodrigues
by: jlrodrigues | last post by:
I have this WebService with a webmethod tha returns XML, accessed by HTTP POST... The webservice response is: <?xml version="1.0" encoding="utf-8"?> XML For XML i create a XMLDocument into whom i load this string:
0
1366
by: Satya | last post by:
Hi I am new using a group and using asp net and vb net. I have the following problem. To resume, in my aspx.vb page I have: strListeGroup.Append("<input type='button' class='buttonPurchasing' name='btnModify' value='Modify' onclick=""document.location.href='USER_ADMIN_GROUP_MODIFY.ASPX?MODE=MODIFY&GROUP=" & strGroup & "&COMPANY=" & strCompany & "';"" tabindex='-1'>")
4
2879
by: ceh | last post by:
Hi, on windows xp I'm using xampp v 1.6.4 I'm trying to send mail. The mail always sends, but the multipart sections are broken. Essentially, I want to send an html email that has a link it, like http://www.google.com so the reader can click on the link. When I get the email, the body is empty.
0
7954
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
7882
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8379
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8250
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
3872
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3908
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2391
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1222
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.