www.webdeveloper.com
Results 1 to 5 of 5

Thread: \What c\harac\ters nee\d to be esca\ped\?

  1. #1

    \What c\harac\ters nee\d to be esca\ped\?

    I've been searching all over the place to see which characters need to be escaped. I know that in order to print text with the characters @#$%&"'\, that I have to escape them by typing \@\#\$\%\&\"\'\\. I also found a list of the text that can be escaped, like \n,\r,\Q ... \E, etc. but I can't find a full list of non-alphabet characters that need to be escaped.
    If you post your email address and don't plan to have a contact form, use www.addressmunger.com.

  2. #2
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  3. #3
    Join Date
    Dec 2002
    Location
    Pleasanton, CA
    Posts
    2,132
    Quote Originally Posted by dominicanpapi82
    ... I know that in order to print text with the characters @#$%&"'\, that I have to escape them by typing \@\#\$\%\&\"\'\\.
    Not quite true if you really mean 'print....'

    If you put your print statement in 'single' quotes, then the only chars that need to be escaped are.... any nested 'single' quotes and the escape char '\'.

    print 'CHARS: @#$%&"/ \' \\' ."\n";

  4. #4
    Quote Originally Posted by Nedals
    Not quite true if you really mean 'print....'

    If you put your print statement in 'single' quotes, then the only chars that need to be escaped are.... any nested 'single' quotes and the escape char '\'.

    print 'CHARS: @#$%&"/ \' \\' ."\n";
    What if I plan on putting everything in double quotes?

    If I do the following:

    print <<EndMARKER;
    line1
    line2
    line3
    etc
    EndMARKER

    What characters do I have to escape then?
    If you post your email address and don't plan to have a contact form, use www.addressmunger.com.

  5. #5
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,270
    See http://perldoc.perl.org/perlop.html#...equence-escape. It's all spelled out there and it's too complicated to just use a list.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles