Form acceptCharset attribute

Definition and usage

acceptCharset Sets or returns the value of the accept-charset attribute in the form element.

The HTML accept-charset attribute specifies the character set to be used for form submission.

The default value is the reserved string "UNKNOWN" (indicating that the encoding is equal to the encoding of the document containing the <form> element).

See also:

HTML Reference Manual:HTML <form> attribute accept-charset

Instance

Example 1

Return the character set that the server should use for form submission:

var x = document.getElementById("myForm").acceptCharset;

Try it yourself

Example 2

Change the value of the accept-charset attribute in the form to UTF-8:

document.getElementById("myForm").acceptCharset = "UTF-8";

Try it yourself

Syntax

Return the acceptCharset attribute:

formObject.acceptCharset

Set the acceptCharset attribute:

formObject.acceptCharset = character-set

Attribute value

Value Description
character-set

Character encoding list used for form submission, separated by spaces or commas.

Common values:

  • UTF-8 - Character encoding for Unicode
  • ISO-8859-1 - Character encoding for Latin letters

Theoretically, any character encoding can be used, but no browser can understand all encodings.

Τόσο πιο ευρέως χρησιμοποιούνται τα χαρακτήρες κωδικοποίησης, τόσο μεγαλύτερη είναι η πιθανότητα να τα κατανοήσει ο περιηγητής.

Για να δείτε όλες τις διαθέσιμες χαρακτήρες κωδικοποίησης, παρακαλώ επισκεφθείτε τονΕγχειρίδιο χαρακτήρων.

Τεχνικά λεπτομέρειες

Αποτελεσματικότητα: Τυπική τιμή字符串, που δείχνει την χαρακτήρα σετ που πρέπει να χρησιμοποιηθεί για την υποβολή του φόρματος στο διακομιστή.

Υποστήριξη περιηγητή

Τα αριθμήματα στη τάβλη επισημαίνουν την έκδοση του προγράμματος περιήγησης που υποστηρίζει πλήρως το χαρακτηριστικό.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη