Nimrod programming language

Dikkie Dik dikkie at nospam.org
Thu May 14 07:56:53 EDT 2009


> 3) Most text files have no header specifying the encoding anyway. How
> should the programm/programmer know? And often he does not need to
> know anyway.


What? Off COURSE texts have no header stating the encoding! And it is
the programmer's responsibility to know what a text's encoding is. So do
not ignore HTTP headers when downloading or other means of communicating
the encoding.

That is the whole problem with texts represented as strings. A string is
a free sequence of bytes, whereas a text is a free sequence of
characters WITH AN ENCODING. This may be a default encoding, but you
must still know which one that is. That is your JOB as a programmer.

Putting the encoding as some sort of header in the string itself is the
worst "solution" that has ever been proposed. Do you put the only key to
a safe inside the very same safe and lock it? Then why do you have to
hack a string (is is not a text as it is not accompanied by an encoding)
to see what encoding is hidden inside?

Ask yourself: would the following "headers" ever work (each given in the
stated encoding off course)?

<meta http-equiv="Content-type" Value="text/html;charset=iso-8859-1">
<meta http-equiv="Content-type" Value="text/html;charset=utf-8">
<meta http-equiv="Content-type" Value="text/html;charset=utf-7">
<meta http-equiv="Content-type" Value="text/html;charset=utf-16">
<meta http-equiv="Content-type" Value="text/html;charset=utf-32">
<meta http-equiv="Content-type" Value="text/html;charset=ebcdic">



More information about the Python-list mailing list