gruber
gruber

Reputation: 29759

alert russian text in javascript in asp.net website

I'm trying to alert Russian text in JavaScript. I have:

<meta charset="UTF-8" />

But what I get is for example: &#1042;&#1072;&#1096; &#1051;&#1086;&#1075;&#1080;&#1085;

What can I do about it?

Here is the code in html:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:asp="http://schemas.microsoft.com/ASPNET/20">

<head id="ctl00_htmlHead"><meta charset="UTF-8" />

...

in the view source html there is

alert("&#1042;&#1072;&#1096; &#1051;&#1086;&#1075;&#1080;&#1085;");

but in my ascx file there is:

alert("Пароль");

Upvotes: 1

Views: 662

Answers (2)

kaz
kaz

Reputation: 1943

Try using this: http://www.strictly-software.com/scripts/downloads/encoder.js

and:

alert(Encoder.htmlDecode("&#1042;&#1072;&#1096; &#1051;&#1086;&#1075;&#1080;&#1085;"));

example: http://jsfiddle.net/gMUKY/

This is encoded in html entities not in javascript utf8 format.

Upvotes: 2

A.B.Cade
A.B.Cade

Reputation: 16915

Try to change the configuration for Auto-Detect UTF-8 encoding without signature.
it should be in Tools -> options -> Text editor

Or make visual studio save the documents in unicode:
Tools -> options -> Environment -> Documents

Upvotes: 1

Related Questions