I have made a sample webpage in hindi. The code is:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
हिन्दिमेबदलना
</body>
</html>
But I want the source code to appear in hindi as well (just like the BBC hindi website) and not in unicode. I mean ह instead of ह
How can I do this?
You can get Devanagari characters in your HTML source by not using HTML entities when creating the file. The following lines are equivalent.
<p>अ आ इ ई</p>
<p>अ आ इ ई</p>
If you are generating your HTML from a database, you might be applying an HTML entity conversion function at the time of generating the markup (such as htmlentities() in PHP). You'll have to remove that function call or apply it selectively.
Related
I develop ASP.Net Core 2.1 RazorPages web application. I want parametrize the the value of asp-page tag helper.
So I use following code in cshtml file. There is a del_link local variable defined in begining of file. This variable is late used as parameter for second asp-page tag helper.
#page
#{
string del_link = "/UnloadDelete";
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div>
<a asp-page="/UnloadEdit">Details</a>
<a asp-page=#del_link>Delete</a>
</div>
</body>
</html>
ASP.Net Razor generate following HTML code.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div>
Details
Delete
</div>
</body>
</html>
As you can see in HTML code, asp-page="/UnloadEdit" is properly rendered to HTML code, but asp-page=#del not, it is rendered to <a href="">. How I can use local variable for asp-page tag helper in Razor Pages?
Thanks in advance.
You must pass a page name to the asp-page attribute. So what you are trying to do is not supported. If #del_link renders a relative URL, you can pass that to the href attribute instead. There may be other suitable solutions, depending on why you feel the need to use #del_link at all.
I just installed Emmet, and when I type html TAB I only get
<html></html>
Before then, when I did so, Sublimetext would create all the default tags:
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
Is there a setting or something I can update in Emmet, or Sublime text so that when I have Emmet enabled, I can get the "full" tags?
The file is a .html file, and it's set to HTML in Sublime.
Here's a quick .gif - I start with Emmet diabled:
In Sublime Text 3 it's
html:5 + tab
Returns:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
In Sublime Text 3 you can type <h, and you will get
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
Also you should make document type HTML
on mine, html + TAB gives me what you're getting, but if I do html + ENTER, then I get the entire boilerplate.
In PHP, it's easy to include a file in another one to avoid redundancy of the code using the include keyword. Is there a similar solution in Node.JS using Handlebars.JS?
From your question it sounds like you are looking for handlebars partials. For an example check out https://github.com/donpark/hbs/tree/master/examples/partial.
In short, you'd have something which looked like:
index.hbs:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Your Website</title>
</head>
<body>
{{> header}}
</body>
</html>
where {{> header}} is referencing the header.hbs partial.
If I set the following in my app.js file, why can't I access it using app.settings.title rather than settings.title in my rendered view? It seems I cannot prefix it with the app object.
...
app.set('title','TestApplication');
...
Why must I do this,
<!DOCTYPE html>
<html lang='en'>
<head>
<title><%= settings.title %></title>
</head>
<body>
</body>
</html>
rather than this?
<!DOCTYPE html>
<html lang='en'>
<head>
<title><%= app.settings.title %></title>
</head>
<body>
</body>
</html>
There is probably a simply answer to this question, but I am new to Javascript and am trying to learn Expressjs and Nodejs.
Thanks
Because variable is extracted before getting to view.
Because express provides some abstraction at the view level. It would be redundant and potentially insecure to expose app to your view, and so it's abstracted away so that you can just directly access settings.
I am programming a Web-Application with Java EE and JSF.
I want to give alert (javascript) messages with Turkish characters (such as Ç,ü and ö etc.) on my app. But, after alert function is fired, I see the alert message with unrelated characters such as <?>, instead of Turkish characters on .xhtml pages on any browser (I tried it on IE10 and Chrome).
I need an advice to handle the problem. If I find a solution, I can also use this to set values of element (ex./h:commandButton) by javascript.
EDIT:
Additional information - Static strings that includes Turkish letters on html or jsf tags are shown properly. However, when I change them via some javascript functions, if there is any Turkish characters in strings that are changed, these Turkish letters cannot be shown properly.
It is too old question but I want to answer for maybe someone need.
If your problem with alert messages, open your javascript file on notepad and save as with Utf-8 options.
Or you can use same technic for others js file you need encoding char.
If its just specific to chrome may be you could try changing the page encoding.
Got Control->Tools->Encoding and change that to Auto Detect or Unicode or turkish etc..
If its a general issue then add the meta info
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1254">
<META HTTP-EQUIV="Content-language" CONTENT="tr">
or
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-9">
<META HTTP-EQUIV="Content-language" CONTENT="tr">
Example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1254">
<META HTTP-EQUIV="Content-language" CONTENT="tr">
<title>Sample</title>
<script>
function alertText() {
alert(document.getElementById("turkish").innerHTML);
}
</script>
</head>
<body>
<div id="turkish">Türkçe olarak hellow dünya</div>
<input type="Button" onclick="alertText()" value="Say" />
</body>
</html>