473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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::uri_escape() and HTML::Entities::encode_entities() methods but not able to get the solution.

Please help me in this.

Thanks in advance.
Oct 16 '07 #1
5 1701
eWish
971 Expert 512MB
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 Expert 2GB
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
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 Expert 2GB
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
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
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
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...
3
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...
2
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
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...
2
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",...); ? ...
1
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
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...
2
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.