Details
-
Type:
Sub-task
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 1.8
-
Fix Version/s: None
-
Component/s: Language
-
Labels:None
-
Environment:Linux / Firefox 2.0.0.1
-
Affected Branches:MOODLE_18_STABLE
Description
I have realized that UTF8 NBSP character copied (or typed as Alt+0160) into the <input> or <textarea> field is converted into ordinary space by browser/server and I can not access it in the $_POST variable. Please, could you try and test following script with your browser and operating system and provide a result report?
<html>
<body>
<?php
if (isset($_POST['var'])) {
$var = $_POST['var'];
echo "##$var##<br />";
for ($i=0 ; $i < strlen($var) ; $i++) {
echo ord($var[$i]).' ';
}
}
?>
<form method="post" action="<? echo $_SERVER['PHP_SELF'];?>" >
(1) Type ordinary space and submit (2) Type nbsp (Alt+0160) and submit (3) compare:
<input name="var" type="text" />
<input type="submit" />
</form>
</body>
</html>
Here are some results (FYI, I'm mostly working on Mac OS X).
Mac OS X 10.4.8:
Firefox 2.0.0.2: the non-breaking space is converted in a normal space (typed or copied).
Camino 1.1a2: the non-breaking space is converted in a normal space (typed or copied).
Safari 2.0.4: the non-breaking space IS NOT converted (I get 160 with your script).
Windows XP:
Firefox 2.0: the non-breaking space is converted in a normal space (typed or copied).
Explorer 6.0: like in Safari, the non-breaking space IS NOT converted (I get 160 with your script).
Seems that Gecko browsers DO translate this, which is BAD
(
Hope this helps !