简体   繁体   中英

How can I show following text in html textarea?

["

I have a String like the following.<\/i>

 21154537878887GHE\u0044\u0045

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"<\/code> to the HTML form element that contains the textarea.<\/i>

<form accept-charset="UTF-8">
    <textarea id="textBox"></textarea>
</form>
<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:<\/i>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM