Re: Re: Unicode Encoding?
Benno Dielmann <[email protected]> Wed, 24 Nov 2004 15:30:40 +0100
| Newsgroups | gmane.comp.python.spe.user |
|---|---|
| Message-ID | <[email protected]> |
On Tuesday 23 November 2004 21:11, Chris Spencer wrote: | Benno Dielmann wrote: | > I'll paste in my solution to this problem which I posted to this mailing | > list some time ago. So here it comes: | | [snip] | | Thanks, that did the trick. That and changing the font to one which | supports Asian characters. Although this hack is far from streamlined. | This trick assumes that all your files will conform to this encoding, | ignoring Python's protocol to list the encoding at the top of the file, | e.g. # -*- coding: utf-8 -*- for utf-8. It'd be nice to have a drop-down | menu that let's you select an encoding, akin to a web-browser, or let | the SPE auto-detect the encoding for each file. Does this really ignore the # -*- coding: ... - string at the top of the file? As far as I understand it sets the default encoding which applies if there isn't any encoding specified (i.e. no such coding string). Why couldn't spe just (auto-)detect the encoding by parsing this coding string instead of the user manually selecting the encoding in some drop-down box? One whould just have to put the proper coding-string on top of each file which is recommended anyway, I think. Python (2.3) prints a deprecation warning anyway if there are non-ascii characters in the file and no encoding specified. Perhaps spe could support the user constructing the coding-string. There we have the drop-down box again ;-). But this box whould just construct a proper python coding string and past it in the right place in the file. What do you think about it? Have fun, Benno.