Discussion:
edit files with cp850 encoding?
Luc Saffre
2004-11-12 14:11:52 UTC
Permalink
Why does SciTE's "File/Encoding..." menu show only a small subset of the
encodings known by Python?

My old DOS files are encoded using "codepage 850", known to Python as
"cp850". In Python I can read such a file using code like::

for line in file("test.txt").readlines():
text = text.decode("cp850")

I would like to use SciTE when editing these files, but if they contain
non-ascii characters, SciTE won't display them correctly.

Any hints or ideas?
Luc
Philippe Lhoste
2004-11-12 23:23:42 UTC
Permalink
Post by Luc Saffre
Why does SciTE's "File/Encoding..." menu show only a small subset of the
encodings known by Python?
My old DOS files are encoded using "codepage 850", known to Python as
text = text.decode("cp850")
I would like to use SciTE when editing these files, but if they contain
non-ascii characters, SciTE won't display them correctly.
Any hints or ideas?
In SciTEUser.properties or SciTEproperties (local), put:
code.page=850
character.set=255

Not sure about the char set, though.

Indeed, it is not as flexible as if it was in the menu, but it should work.
--
Philippe Lhoste
-- (near) Paris -- France
-- Professional programmer and amateur artist
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --
Luc Saffre
2004-11-13 20:38:23 UTC
Permalink
That's it! Wow! SciTE is great! No need (for me) to put this into a
menu, anyway I wanted some automated behaviour.
Merci, Philippe.

Oops, there is still a problem: SciTE now seems to misunderstand my
keyboard. When typing new text, all characters above ascii 127 are
completely wrong. Examples:
if I type an "Ä" (142), I get an "─" (196),
if I type an "ß" (225), I get an "▀" (223).

The wrong caracters remain wrong even if I save the file and open it
with a DOS text editor. So I think it is not a display or font problem,
but rather as if somewhere (between keyboard input and inserting the
character) happens one conversion too much.

Luc
Post by Philippe Lhoste
Post by Luc Saffre
Why does SciTE's "File/Encoding..." menu show only a small subset of
the encodings known by Python?
My old DOS files are encoded using "codepage 850", known to Python as
text = text.decode("cp850")
I would like to use SciTE when editing these files, but if they
contain non-ascii characters, SciTE won't display them correctly.
Any hints or ideas?
code.page=850
character.set=255
Not sure about the char set, though.
Indeed, it is not as flexible as if it was in the menu, but it should work.
Continue reading on narkive:
Loading...