escaping backslashes 
Author Message
 escaping backslashes

Hi, there must be a really obvious solution to this but I
cant find it.

How do i declare a variable such as

var serverPath = "\\servername\etc"

The browser doesnt like the double backslashes, and
throws an exception saying expected hexadecimal character.

Single backslashes appear to be ok.

Thanks

Adam



Sun, 14 Aug 2005 00:29:16 GMT  
 escaping backslashes
adam wrote on 25 feb 2003 in microsoft.public.scripting.jscript:

Quote:
> How do i declare a variable such as

> var serverPath = "\\servername\etc"

> The browser doesnt like the double backslashes, and
> throws an exception saying expected hexadecimal character.

var serverPath = "\"+"\servername\etc"

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)



Sun, 14 Aug 2005 00:36:59 GMT  
 escaping backslashes
Unfortunately this doesnt work.

I presume becuase \" is escaped "

Quote:
>var serverPath = "\"+"\servername\etc"

>--
>Evertjan.
>The Netherlands.
>(Please change the x'es to dots in my emailaddress)
>.



Sun, 14 Aug 2005 02:51:58 GMT  
 escaping backslashes
adam wrote on 25 feb 2003 in microsoft.public.scripting.jscript:

Quote:
> Unfortunately this doesnt work.

> I presume becuase \" is escaped "

Try this:

<script>
        alert("\\\\hi")
</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)



Sun, 14 Aug 2005 03:02:36 GMT  
 escaping backslashes

Quote:

>Try this:

><script>
>            alert("\\\\hi")
></script>

>--

This doesnt work either. I presume you tried this on your
machine and it was ok, so is there something funny about
mine?

Adam



Sun, 14 Aug 2005 03:23:33 GMT  
 escaping backslashes
adam wrote on 25 feb 2003 in microsoft.public.scripting.jscript:

Quote:
>>Try this:

>><script>
>>         alert("\\\\hi")
>></script>
> This doesnt work either. I presume you tried this on your
> machine and it was ok, so is there something funny about
> mine?

Yes.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)



Sun, 14 Aug 2005 03:42:41 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Stop backslash behaving as the escape character

2. escape doesn't escape JScript 5.0

3. escape Javascript equivalant in VBA for URL Escape Sequences

4. Backslash disapears

5. getting to read the backslash

6. Backslash problems - help!

7. How to print backslash?

8. Reading registry values containing a backslash (\)

9. double backslashes

10. Slash/Backslash, Absolute/Relative Path in FSO

11. using Registry functions on valuenames with backslashes?

12. Using Backslash with RegWrite

 

 
Powered by phpBB® Forum Software