[Tutor] Encoding

spir denis.spir at gmail.com
Thu Mar 4 07:02:04 CET 2010

On Wed, 3 Mar 2010 16:32:01 +0100
Giorgio <anothernetfellow at gmail.com> wrote:

> Uff, encoding is a very painful thing in programming.

For sure, but it's true for any kind of data, not only text :-) Think at music or images *formats*. The issue is a bit obscured for text but the use of the mysterious, _cryptic_ (!), word "encoding".

When editing an image using a software tool, there is a live representation of the image in memory (say, a plain pixel 2D array), which is probably what the developper found most practicle for image processing. [text processing in python: unicode string type] When the job is finished, you can choose between various formats (png, gif, jpeg..) to save and or transfer it. [text: utf-8/16/32, iso-8859-*, ascii...]. Conversely, if you to edit an existing image, the software needs to convert back from the file format into its internal representation; the format need to be indicated in file, or by the user, or guessed.

The only difference with text is that there is no builtin image or sound representation _type_ in python -- only because text and sound are domain specific data while text is needed everywhere.


la vita e estrany


More information about the Tutor mailing list