Unicode / utf-8 characters in AngularJS routes

I am interested in using readable routes with Hebrew characters in them in an AngularJS application:

http://localhost/#!/project/מה+המצב

However, when starting the URL through the AngularJS router, the following URL is displayed in the address bar of the browser:

http://localhost/#!/project/%D7%9E%D7%94%20%D7%94%D7%9E%D7%A6%D7%91

I tried navigating to the URL on a simple page without corners, and the URL displayed well in the address bar, which makes me think that the culprit is AngularJS.

How to implement this?

+4
source share
1 answer

You need to enable html5 mode ( $locationProvider.html5Mode(true).hashPrefix('!');in application configuration). Than the browser will correctly display utf8 characters in the address bar.

+1

Source: https://habr.com/ru/post/1542093/


All Articles