Oskar Oskar
Oskar Oskar

Reputation: 19

HTML ISO-8859-2 form encoding

I have to send some values via post ISO-8859-2 encoded.

When the receiver got and displayed the message it was something like

Ä…,ć,Ä™,Ĺ‚,Ĺ„,Ăł,Ĺ›,Ĺş,Ĺź,Ä„,Ć,Ę,Ĺ,Ĺƒ,Ă“,Ĺš,Ĺš,Ĺť

(stack overflow cannot display all of them by paste).

The example of html page that submit form:

<html>
<SCRIPT LANGUAGE="Javascript">
  function OnLoadEvent() {
    document.downloadForm.submit();
  }
</SCRIPT>

<head>
  <meta charset="ISO-8859-2">
</head>

<body OnLoad="OnLoadEvent();">
  <form name="downloadForm" accept-charset="ISO-8859-2" action="https://url" method="POST">
    <INPUT type="hidden" name="Description" value="ŃÓô">
  </form>
</body>

</html>

I have also write simple page to display some of the characters. Page:

<!DOCTYPE HTML>
<HTML>

<HEAD>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-2">
</HEAD>

<BODY>
  Ńóô
</BODY>

</HTML>

But it also displays something like that: ĹƒĂłĂ´ Do you know what is the reason of that? If Im thinking good this charset should handle all of the latin characters.

Upvotes: 1

Views: 822

Answers (1)

deceze
deceze

Reputation: 522567

This indicates that the actual text is not actually ISO-8859-2 encoded. You denote that it is, causing the browser to treat the bytes as ISO-8859-2, but actually the bytes are UTF-8 encoded. The UTF-8 encoded bytes for "Ńóô" are c583 c3b3 c3b4. The ISO-8859-2 interpretation of this byte sequence is something like "Ĺóô".

Actually save the HTML file as ISO-8859-2 in your text editor.

Upvotes: 0

Related Questions