2

in query string have persian character but url like this :

localhost:53297/#/Item/News/1-1-1-3?title=%D8%B1%D9%88%D9%86%D9%85%D8%A7%DB%8C%DB%8C%20%D8%A7%D8%B2%20%D8%AA%D8%A8%D9%84%D8%AA%20%D9%87%D8%A7%DB%8C%20%D8%B4%D8%B1%DA%A9%D8%AA%20HP

I want url like this:

localhost:53297/#/Item/News/1-1-1-3?title=طلا-نقره
2
  • try using encodeURIComponent Commented Oct 27, 2014 at 10:05
  • tanx I tried but not help me. it was code my url i need decode my url Commented Oct 27, 2014 at 10:38

3 Answers 3

4

try using decodeURIComponent(yourUrl)

and globally you can use something like this

$rootScope.$on('$locationChangeStart', function (e, newUrl, oldUrl) {
    $location.$$absUrl = decodeURIComponent(newUrl);
});
Sign up to request clarification or add additional context in comments.

1 Comment

I used it for a while but it does'nt work anymore ! :| any idea?
2

Try to use following package: https://github.com/usablica/persian.js

Comments

0

I fixed answers:

var newUrl = persianJs(searchQuery).fixURL().toString();

$rootScope.$on('$locationChangeStart', function (e, newUrl, oldUrl) {
    $location.$$absUrl = decodeURIComponent(newUrl);
});

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.