本文介绍了UriMapper中不支持Unicode字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我会使用以下代码

    <sdk:Frame
       x:Name="ContentFrame"
       Source="/صفحه-اول">
            <sdk:Frame.UriMapper >
                <sdk:UriMapper>
               <sdk:UriMapping
                Uri="/صفحه-اول"
                MappedUri="/pages/Page1.xaml"/>
                    <sdk:UriMapping
                Uri="/صفحه-دوم"
                MappedUri="/pages/Page2.xaml"/>
                </sdk:UriMapper>
            </sdk:Frame.UriMapper>
        </sdk:Frame>

以下是链接?

错误显示:

http:// localhost:19908 / SilverlightApplication12TestPage.aspx#/%D8%B5%D9%81%D8%AD%D9%87%D8%A7%D9%88%D9%84

http://localhost:19908/SilverlightApplication12TestPage.aspx#/%D8%B5%D9%81%D8%AD%D9%87-%D8%A7%D9%88%D9%84

结果应如下所示:

这是正确的网址:

http:// localhost:19908 / SilverlightApplication12TestPage.aspx#/صفحه-اول

http://localhost:19908/SilverlightApplication12TestPage.aspx#/صفحه-اول

推荐答案

据我所知,网址中的字符只能是ASCII字符,但ASCII字符相对较小,URL通常包含ASCII字符集以外的字符,如非英文字符,中文字符,特殊
符号等,因此URL被转换。此过程称为URL编码,或URL转义,实质上将包含非ASCII字符,以将URL转换为有效的ASCII字符格式。

As far as I know, the characters in the URL can only be ASCII characters, but the ASCII characters are relatively small, and the URL often contains characters other than the ASCII character set, such as non-English characters, Chinese characters, special symbols, etc., so the URL is converted. This process is called URL encoding, or URL escaping, in essence, will contain non-ASCII characters to convert the URL to a valid ASCII character format.

因此,您的网址包含特殊字符,您将收到"错误显示"。

So, your url includes special characters, you will get the "bad display".

HttpServerUtility.UrlEncode方法(字符串):

https://msdn.microsoft.com/en-us/library/zttxte6w%28v=vs。 110%29.aspx?f = 255& MSPPError = -2147217396

HttpServerUtility.UrlEncode Method (String):
https://msdn.microsoft.com/en-us/library/zttxte6w%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396

如果您想了解URL编码,可以访问
ASP.NET论坛
获取合适的帮助。

If you want to know about URL encoding, you can visit the ASP.NET forum for getting suitable help.

最好的问候,

Yohann Lu

Yohann Lu


这篇关于UriMapper中不支持Unicode字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 21:39