Re: Encoding / Entity in input element



On Tue, 18 Apr 2006, Gazza wrote:

<http://garyjones.co.uk/development/input.html>

I'm trying to get a Rupee Sign (&#8360) displayed in an input field,

Your posting is inconsistent with your test page - your "input field"
does not contain the value &#8360;

and from the demo page it's clearly not working.

If you're having problems with HTML, wouldn't it be nicer to get the
javascript stuff out of the way, in case it's causing unnecessary
complications?

The HTML DTD says that input values
are #CDATA, whereas most other attributes are #PCDATA,

This is confusing stuff. CDATA in an attribute value doesn't have the
same implications as CDATA as element content model. Certainly you
can expect value="&#8360;" to be parsed and interpreted as the
character which it represents, just as your title="&#8360;" is already
being so interpreted (I'm seeing a pop-up that says "Rp" when I hover
over your empty text field).

That would not be the case in CDATA element content (script or style
elements, in HTML).

Your *Javascript* element content is CDATA, and you've no business
trying to use HTML notation in there (except when the results of the
JS are going to be interpreted as HTML, of course, such as modifying
the DOM, or document.write...).

and the lack of parsing
is why I'm getting a literal "&#8360" as the value.

No. If you're seeing that (but *where* exactly are you seeing it?
You've introduced too much complexity, your posting seems to me to be
incompatible with your test case, and you aren't making it clear what
you tried), my hunch is that it's for a very different reason.

Your served-out page is encoded in iso-8859-1, so it cannot submit a
rupee character as such. Recent browsers have, lemming-like, all
leaped on the MS bandwagon of applying a completely illogical
HTML-ification of submitted characters if they can't be coded in the
page's own character encoding.

http://ppewww.ph.gla.ac.uk/~flavell/charset/form-i18n.html might help
with some background (but no javascript, though).

As a side note, I'm assuming that the reason that the sign appears
as "Rs" in a paragraph and as "Rp" in an option element are due to
the different fonts being used?

I'm not yet sure. The unicode database shows &#8360; (U+20A8) as a
compatibility character, decomposing to 0052 0073, which is "Rs"; a
browser would be in its right to display that if it felt so inclined,
e.g if it couldn't find a suitable font.

best I can do at the mo, E&OE
.



Relevant Pages

  • Re: Clear out an html dom object
    ... HTML 4.01 strict doctype and get ride of that CDATA stuff ... Do you know exactly what the CDATA stuff is there for? ... inside script elements will be 'commented out' with javascript or HTML-like ...
    (comp.lang.javascript)
  • Re: Adding successive input fields - best practices?
    ... I'd like to be able to put most of the HTML somewhere in a hidden div, ... the index of the "name" field for each new input field. ... Well assuming you didn't have the forms packed into the javascript ...
    (comp.lang.javascript)
  • CDATA, Kommentare und typo3 crypt Funktion
    ... Wenn ich aber einen email String mit den typo3 typischen ... Damit sollte der HTML Validator doch gar nichts am Hut haben ... Das CDATA hat doch hier genau diese ...
    (de.comp.lang.javascript)
  • Re: Radio buttons do not appear checked
    ... >that the Name attributes are described as CDATA and the term CDATA is ... CDATA is a sequence of characters from the document character set and may ... For some HTML 4 attributes with CDATA attribute values, ... IDREF is a single token and IDREFS is a space-separated list of tokens. ...
    (comp.lang.php)
  • Re: 3.9 Links package broken?
    ... the cursor on a text input field. ... I cannot use lynx to send email since lynx does not support javascript ... but it only recognises upper case. ... are accepted as input to text fields in html forms, ...
    (comp.unix.bsd.openbsd.misc)