AnglarJS路由中的Unicode / utf-8字符

时间:2021-03-28 00:26:19

I'm interested in using readable routes with hebrew characters in them in an AngularJS application:

我有兴趣在AngularJS应用程序中使用带有希伯来字符的可读路由:

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

However, when I run the URL through the AngularJS router, the browser address bar shows the following URL:

但是,当我通过AngularJS路由器运行URL时,浏览器地址栏显示以下URL:

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

I have tried to navigate to the URL on a simple page, without angular, and the URL shows up fine in the address bar, which leads me to believe that AngularJS is the culprit.

我试图在一个简单的页面上导航到URL,没有角度,并且URL在地址栏中显示正常,这让我相信AngularJS是罪魁祸首。

Does anyone have an idea how to implement this?

有谁知道如何实现这个?

1 个解决方案

#1


1  

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

您需要启用html5模式($ locationProvider.html5Mode(true).hashPrefix('!');在app配置中)。浏览器会在地址栏中正确显示utf8字符。

#1


1  

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

您需要启用html5模式($ locationProvider.html5Mode(true).hashPrefix('!');在app配置中)。浏览器会在地址栏中正确显示utf8字符。