[thelist] Textarea issue when using charset=UTF-8
John Walker
john_walker2002 at hotmail.com
Tue Jun 21 09:30:16 CDT 2005
All -
I am at a complete loss here both in understanding and knowledge so I turn
to everyone (anyone) for some insight and HELP!!!
Two examples:
HTML version includes the following:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
JSP version includes the following:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
Here is the source for the page(s) just save as .JSP and you have the jsp
version with the noted change from above
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Textarea Test</title>
</head>
<body>
<form NAME="myForm">
<textarea rows="4" cols="80" name="box0"></textarea>
<input type="button" name="myBtn1" value="Test 1"
onclick="alert(this.form.box0.value)"></input>
<br><br><br>
<textarea rows="4" cols="80" name="box1" wrap="physical"></textarea>
<input type="button" name="myBtn2" value="Test 2"
onclick="alert(this.form.box1.value)"></input>
<br><br><br>
Test input:
<br>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1234567890
<br>
Character count: 520
</form>
</body>
</html>
If testing as an HTML and you leave the meta tag in when you click the
button to see the "value" of what is in the textarea, the last character '0'
is dropped. The same goes for the JSP using the other include.
Take the meta tag in question out of the HTML or JSP file and the alert
shows exactly what is in the textarea.
KEY NOTE:
I am testing this against Netscape 4.79
It works fine in IE
And before you ask....YES. It is requirement that it works in NS 4.79
The original idea was to include
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
OR
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
in our pages to handle cut & paste content that the browser might not
otherwise understand. Without this there are certain characters that when
pasted into a textarea are displayed as open squares. It was thought that
by including the tag in question this would help reduce that. Which it has,
but it has now introduced another problem
Final FYI
This test page does not show yet another issue...when using this on a 'live'
page with a save button that sends the data back to the DB; the last letter
is dropped each time the save button is pressed until the character count
reaches 511. Once there it remains stable.
More information about the thelist
mailing list