0

My problem is simple, but I can't find a way to fix it. I hope to get some help here. Since I had problems with language support on my page, I was forced to use letter codes. E.g. А Б - Russian letters А and Б. Because I don't have that much of Russian content on the page, I didn't bother to search for alternative way. But I stuck with this problem:

        function updateTips( t ) {
            tips
                .text( t )
                .addClass( "ui-state-highlight" );
            setTimeout(function() {
                tips.removeClass( "ui-state-highlight", 1500 );
            }, 500 );
        }
        function checkLength( o, n, min, max ) {
            if ( o.val().length > max || o.val().length < min ) {
                o.addClass( "ui-state-error" );
                //here is my problem situated
                updateTips( "&#1044;&#1083;&#1080;&#1085;&#1072; " + n + " &#1076;&#1086;&#1083;&#1078;&#1085;&#1072; &#1073;&#1099;&#1090;&#1100; &#1084;&#1091;&#1078;&#1076;&#1091; " + min + " &#1080; " + max + "." );
                return false;
            } else {
                return true;
            }
        }
        function checkRegexp( o, regexp, n ) {
            if ( !( regexp.test( o.val() ) ) ) {
                o.addClass( "ui-state-error" );
                updateTips( n );
                return false;
            } else {
                return true;
            }
        }

When the code is executed, the output isn't the one I wish to see. As the output I see same "&#1044;&#1083;&#1080;&#1085;&#1072;...." and it supposed to show letters, which belong to those codes. Any advise or alternative way for fixing this issue would be appreciated. Thank you in advance.

SinSoul
  • 83
  • 1
  • 12
  • 1
    Somewhat of a duplicate of http://stackoverflow.com/questions/1219860/javascript-jquery-html-encoding Answer you are looking for with a clean implementation. – Mark Mar 31 '11 at 01:31

1 Answers1

2

In function updateTips( t ), change .text to .html.

This should fix it.

Edit:

The reason for this is because the point of .text() is explicitly to not interpret whatever is in the string. It's meant for things like XML, where you need the string exactly as it was passed.

rockerest
  • 10,412
  • 3
  • 37
  • 67