开发者

javascript unicode property from c#

开发者 https://www.devze.com 2023-04-10 02:48 出处:网络
Im using this code: 开发者_如何学JAVA$(document).ready(function () { var breadCrumps = $(\'.breadcrumb\');

Im using this code:

开发者_如何学JAVA$(document).ready(function () {
    var breadCrumps = $('.breadcrumb');
    breadCrumps.find('span').text("<%= ArticleSectionData.title %>");
});

title is a property which has values encoded in unicode (I think). These are Greek letters. On the local IIS developer server (embedded in visual studio), the characters are displayed in correct way but, on the test server they appear as:

&#931;

Do You know any solution for this problem ?

Thanks for help

EDIT:

I have changed the code a little bit:

breadCrumps.find('span').text(<%= ArticleSectionData.title %>);

And now it works correctly, encoding is frustrating ...


If you are working off of a different database in test than in dev, then I suspect the issue is with the data. If you are storing HTML entities (eg, &#931;) in your database, then you need to use .html(). If you are storing actual unicode characters (eg, Σ) in the database, then you need to use .text(). The way to represent Σ in html is with &#931;. But if you set the text of an element to &#931;, it displays that literally - the innerHTML of that element would contain &amp;#931;.


I don't know root of problem, but you can use this http://www.strictly-software.com/htmlencode for decode &#931; to Sigma

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号