Jump to content

Problem with special characters.

- - - - -

  • Please log in to reply
3 replies to this topic

#1
MicroBoy

MicroBoy

    Newbie

  • Members
  • PipPip
  • 22 posts
<a href="kodi.php?kalkulo=a\neq b^n" onclick="return popitup('kodi.php?kalkulo=a\neq b^n')" >Open</a>

If I use just "a href" everything it is ok, but when I use popitup function, the url is
/kodi.php?kalkulo=aeq b^n
instead of
/kodi.php?kalkulo=a\neq b^n

So do I have to change something at popitup function or what?

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
Quite a few non-alphanumeric characters are not allowed within the URI, for example the back slash should be encoded as %5C, as in:
a%5Cneq%20b%5En

Javascript has the encodeURIComponent() function and PHP has the urlencode/urldecode functions to work with this behaviour.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
backslash is used for various special characters in javascript. \n will result in a newline. You propably want \\ for 1 backslash.

#4
MicroBoy

MicroBoy

    Newbie

  • Members
  • PipPip
  • 22 posts
I use this above script for the popup where to write the encodeURIComponent, cause that URL changes it is not always the same?

function popitup(url) {

	newwindow=window.open(url,'name','height=436,width=626');

	if (window.focus) {newwindow.focus()}

	return false;

}






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users