473,796 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help in escaping the character "#" from the url

55 New Member
Dear All,

I am facing a problem in escaping the character "#" from the url. I am working in Mason framework now which uses Perl, HTML and Javascript.

What I really want is to escape the character "#" from the value assigned to a variable. As this value gets appended to the url, I am not getting the correct and expected values.

Eg: Suppose $value = "My#Group";

Here I want to escape the character # so that the variable $value contains the value "My#Group" instead of "My" as Perl considers the character # as the starting of comments and comments whatever is there after that.

Moreover the value of this variable gets appended to the previously existing url and as Perl treats # as commenting character, it is not considering the values after # in the url.

I have used URI::Escape::ur i_escape() and HTML::Entities: :encode_entitie s() methods but not able to get the solution.

Please help me in this.

Thanks in advance.
Oct 16 '07 #1
5 1723
eWish
971 Recognized Expert Contributor
If I understand you correctly, you want to be able to include the '#" symbol in a variable.

Expand|Select|Wrap|Line Numbers
  1. my $test_val  = qq{Some#Name};
  2. my $test_val1 = q{Some#Name};
  3. my $test_val2 = 'Some#Name';
  4. my $test_val3 = "Some#Name";
Oct 16 '07 #2
KevinADC
4,059 Recognized Expert Specialist
The # symbol is not considered a comment in the context it's being used. There should be no problem to have a # symbol in a URL.
Oct 17 '07 #3
rellaboyina
55 New Member
The # symbol is not considered a comment in the context it's being used. There should be no problem to have a # symbol in a URL.

Dear Kevin

When I tried to copy the url in the address bar and pasted it in an editor, the text which is after the character # in the url appears to be commented when the file view is Perl.

Eg; In EditPlus, if the file view type is perl and I pasted the url in the editor, the text after # appears to be commented.
Oct 17 '07 #4
KevinADC
4,059 Recognized Expert Specialist
Well, thats an editor. It may depend on how you view it in the editor, but a # in a single or double-quoted string is just a literal #, it is not a comment.

Expand|Select|Wrap|Line Numbers
  1. # this a comment
  2. $foo = "# this is not a comment";
Oct 17 '07 #5
rellaboyina
55 New Member
Well, thats an editor. It may depend on how you view it in the editor, but a # in a single or double-quoted string is just a literal #, it is not a comment.

Expand|Select|Wrap|Line Numbers
  1. # this a comment
  2. $foo = "# this is not a comment";

Thanks for the reply.
Oct 17 '07 #6

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

Similar topics

0
4888
by: farseer | last post by:
Hi, i have a file which contains data that is delimted by non-printable character "0x1f". how can i parse this file with that character as the delimiter?
6
4570
by: Joe Price | last post by:
Hi all I've formatted one of my xml files for viewing through a web browser using xsl. It works fine in Internet Explorer, however when I use Netscape6 or Opera to view the same page the disable-output-escaping function does not work and it is displaying html tags as text rather than code. Can anyone enlighten me as to why this is happening? Am i using the wrong namespace? i'm currently using:
3
3647
by: NecroJoe | last post by:
I am using PHP to generate a little javascript for one of my pages. In short it allows a user to select a value from a list and pop it into a form field on a seperate page. This works well unless there is a " or ' in the character string. <SCRIPT language=JavaScript> function Add_Term(SearchTerm) { window.opener.document.advsearch.name_title.value += SearchTerm; window.close();
2
1870
by: Serdge Kooleman | last post by:
hi i'm trying to play sounds in my windows app. wav files are in the same folder as .exe if i'm getting path by command: ApplicationPath = Application.StartupPath; and it is look like
6
1809
by: Lucvdv | last post by:
In a sorted list, certain characters are grouped together, for example "çb" (cedille b) comes after "ca" but before "cc". Is there a built-in way to find out what 'base character', such as C for cedille, a character belongs to for a given globalization setting?
2
3793
by: Kannan | last post by:
In section 7.19.6.1 on ISO C specification, it says about a format character "space". When and how we will use this "space" format? I mean is there a usage, for e.g. like printf("%space",...); ? Thanks, Kannan
1
1629
by: Kris | last post by:
Hi.. Why is it impossible to add a "&" character to item in VS2005 menustrip? In properties, it preserves itself as "&", but in menu, shows up as some small line instead of &. Can you help?
4
9183
by: Jon | last post by:
Hi, I used XslCompiledTransform with the following Xsl file. The <xsl:text disable-output-escaping="yes"does not work when using XslCompiledTransform to do the trnasform (namely the output contain < not <), while it works when using MSXML2 to do the transform. Does anyone have the same problem and how to make the escape work? Thanks. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
2
5584
by: Diilb | last post by:
I am using DOM to create an rss feed. The problem I am running into is "special characters" such as é è ç. If I try adding them to the XML as character data (CData), DOM chokes and throws out errors. If I do a search and replace on the characters changing them to HTML entities instead of using CDATA, DOM chokes up again. If I do a combination of both (search and replace then add as Character Data) it does not choke, but the RSS...
0
9685
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
9533
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
10461
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...
1
10190
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
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
9057
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.