How can I show following text in html textarea? - html

I have a String like the following. Please take a look:
I put it as a image, this is not displaying in here too. If I put that String here it becomes the following:
21154537878887GHE\u0044\u0045
Now my question: is there any way to put the original String into an HTML <textarea> without changing the encoding?

I think you must define your char set in the head.
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="denis kohl">
<!-- Date: 2014-09-04 -->
</head>
<body>

Try adding the attribute accept-charset="UTF-8" to the HTML form element that contains the textarea. Then parse the encoded value via JavaScript. For example:
HTML:
<form accept-charset="UTF-8">
<textarea id="textBox"></textarea>
</form>
JavaScript:
document.getElementById("textBox").value = "21154537878887GHE\u0044\u0045";

<textarea name="Input" cols="36" rows="5" wrap="virtual">
Could you try to define the wrap method, you can choose:
wrap: off, virtual, hard, physical, soft
The Textarea formatting looks nothing like they originally intended. Typically, all the Textarea text will squashed into a single paragraph with none of the original line breaks or spacing in evidence.
The reason for this is that the CGI program (to handle the text in the textbox) has to specify a MIME Type when they are preparing the email or other document and many of these programs elect to use a MIME Type of "text/html" so that they can use HTML formatting to make the email or document more presentable. The problem with this approach is that the contents of an HTML Textarea input box require the use of a MIME Type "text/plain" otherwise the Textarea formatting will not display properly in the final output.
<meta http-equiv="Content-Type" content="text/plain; charset=utf-8">
Knowing the above I hope this will help you to find the solution.

Do this:
<textarea>211&#001c;545&#001c;378887GHE\u0044\u0045</textarea>
Note that what happens when this is rendered is that all the characters that can be displayed in the chosen (in css) font are displayed normally, while most browsers fall back to the Unicode BMP Fallback Font (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&item_id=UnicodeBMPFallbackFont) which simply fills in the gaps in whatever font you might be using. The exact result will be browser-dependent.

Related

HTML how to get it to display čšž on your site

Trying to learn to make a site. And right from the start:
How do I get HTML to display ščž and other various special characters like ł,ß,ö..?
You need to specify a character set so the browser knows what's being used in the page. For example, in your head section, try putting:-
<meta charset="UTF-8">
You can also try specifying symbols using their entity name/code, using the character reference table here - https://dev.w3.org/html5/html-author/charref
Here's an HTML5 example. meta declares the encoding of the HTML file. Make sure to save the file in that encoding!
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Example</title>
</head>
<body>How do I get HTML to display ščž and other various special characters like ł,ß,ö,&#x9A6C..?</body>
</html>
You can enter any character you know the Unicode codepoint using &#xnnnn syntax. In the example above, U+9A6C is the Chinese character for horse(马).

How I Override Body Tag In Ctrl+Shift+I Inspector

I have some Html code
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>ControlShiftI Example</title>
</head>
<body>
Enter UserName <input type="text" name="user"><br>
Enter Password <input type="password" class="password-input" name="pass">
</body>
</html>
that I am running on browser after ctrl+shift+i in inspecor I want to override some other code in complete body tag.
in above after I dont want to see this body tag code some override code i want see.
is this possible?
This is not possible.
Hide Javascript
If your concern is having a tidier HTML because Javascript code takes too much space, just <script src="externalFile.js"></script>
If your concern is you want to hide your code, because you don't want others to read it and understand it, you could minify and obfuscate the code, for example with UglifyJS. However the inspector can undo the minification by prettifying the code. Obfuscation however cannot be totally undone depending on techniques used.
Hide HTML
If this question is not about javascript and you want to reduce the number of html lines:
<object data="externalHTMLFile.html"></object>
or
<iframe src="externalHTMLFile.html"></iframe>
There are also other ways.
But you cannot simply hide some html from the inspector or remove the ability from the user to open the external HTML file and read all the HTML.

htmllabel for objective c swaps words for Right to Left Languages [Arabic]

I am using HTMLLabel class to display html content [string with some attributes for subparts (e.g. bold ,italic and color)].I have faced some problems like \n should be replaced <br/> when appending to the content of the HTMLLabel -__- but over all every thing worked just fine until I tried to write RTL language in the html file.. The result was not expected as words are shown swapped. for example :
{السلام عليكم والرحمة }
is shown like this :
{الرحمة و عليكم السلام }
I have posted the issue in the HTMLLabel page in GitHup..
Any help is extremely appreciated..
EDIT:
The result I am getting from the server is a list of strings like :
"السلام عليكم <b>والرحمة</b>"
NOT an HTML File!
You need these to create a HTML5 page with language as Arabic, direction as RTL, and utf-8 encoded
<!DOCTYPE html> For declaring it as a HTML5 page
<html dir="rtl" lang="ar"> For direction and language
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> For utf-8

How to fix the font issue in HTML?

I have Html (hello.html) like bellow
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Test</title>
</head>
<body>
<div>
¿Hola cómo está?
</div>
</body>
</html>
It shows out as "¿Hola cómo está?" when run in browser
Is there any solution to get correct out put without altering the
hello.html file?
I hope that, it is in Spanish language but i looking for any other solution like as change the encode type or font in browser or editor.
Edit: Just noticed the requirement. But some Spanish characters require Unicode and you have to declare that in your html file.
Put this in your head.
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
I don't see whats wrong, if you are refering to the font type in the html and the webpage is different is because of your editor, if you really want to change the font you will need to set the font tag around your text or even better define it in the CSS
Based on the clarification in the comment section to your question....
If you are using Google Chrome, and your computer is set to an English locale, load the page, then right click on the body, and select "Translate to English."
Sounds like an interview trick question, rather than a programming one.
No.
You cannot do this without altering the html file.
Place this <meta> tag in your Head Section
<meta charset="UTF-8">

Including HTML <meta> element conditionally

Firstly, I've done some Google'ing and found the IE 'conditional comment' and understand it's non-standard. I also get the impression there is no standard HTML 'IF' so my question is about what I need to do to achieve the same effect (Javascript perhaps?)...
I'd like to conditionally include an external .html file (from a selection of external .html files). Specifically, the external files each contains nothing but a <meta> element on a single line. Alternatively is it possible to have multiple inline <meta> elements in a HTML file and to 'choose' one conditionally (effectively ignoring the others)?
Basically, can I do something that would achieve the same as one of either of these pseudo code examples?
Example using pseudo code for external files...
<html>
<head>
if some-condition
<!--#include file="meta1.html" -->
else
<!--#include file="meta2.html" -->
...
</head>
...
</html>
Alternative example (again pseudo code) for selecting alternative elements directly...
<html>
<head>
if some-condition
<meta name="viewport" content="abc" />
else
<meta name="viewport" content="def" />
...
</head>
...
</html>
NOTE: In all cases the <meta name attribute will always be viewport - it's just the content attribute which needs changing perhaps with some other attributes.
EDIT: The main condition would be the type of client. One example is that to help correctly size web app pages on an Android device you can use certain content data for the viewport that only Android devices understand. For conventional browsers, I would set a default set of data for content (for width/height for example). This could also be expanded for other clients such as Google TV, iOS etc etc.
Using Javascript:
document.head.insertAdjacentHTML( 'beforeEnd', '<meta name="viewport" content="abc" />' );
Demo: http://jsfiddle.net/ThinkingStiff/ccX5p/
You could do this with javascript / jQuery quite easily.
Set your conditions and then append() to the head.
Example:
if(//condition here){
$('head').append('<meta name="viewport" content="abc" />')
}
else{
$('head').append('<meta name="viewport" content="def" />')
}
if you are using a server side, like asp or java, the thing becomes lot easier for you.
i shall consider you are not using server side coding.
use javascript for getting the browser name (navigator.appname I guess).
then you may use DOM to add <meta ..../> tags inside <head> element.
document.getElementsByTagNam('Head').appendChild(metaChild);