0

I've been developing an application where I do a lot of $.get to import the contents from other files into the project.

The name of the files have special characters like this =><.
For example: division_squaremeter_l=x<y.php.

Yesterday I had to publish a beta version for my client to see and since I've done that, all requests to those files have been URL encoded in my local machine.
I've manage to have it working on the server, but now, when I run the project on MAMP, I get a lot of 404 messages saying that those files doesn't exist.

And when I debug to see the name of the file, they appear like this: division_squaremeter_l=x%3Cy.php

I've tried avoiding URL encode using functions like decodeURIComponent() but with no success.

Is there a workaround for this problem?

This is a piece of my code:

$.get(BASE_URL+'sections/division_squaremeter_l=x<y.php', function(response){
    $('#DIVISION_CONTAINER_ONE').html(response);
});
1
  • No, it isn't possible to pass any special characters in an URL, they will get encoded like < getting to %3C. But whats the benefit of giving your files names like that? Just call it "division_squaremeter_l_is_x_smaller_y.php". Commented Sep 17, 2015 at 10:12

1 Answer 1

1

NEVER use encodeURI(). use encodeURIComponent() instead. the first 1 includes a lot of guessing from the browser, and is an unreliable relic from an ancient bad design decision.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.