[Scribus] Bug in calendar script: python is the reason

Craig Ringer craig
Thu Oct 28 14:06:55 CEST 2004


On Thu, 2004-10-28 at 18:40, Wolfgang Pagel wrote:
> Eilert wrote:
> > Hi all,
> > 
> > I just found what caused the bug in the calendar script here: it seems 
> > that python doesn't accept characters larger than 128, i. e. German 
> > Umlauts, French accents etc. EVEN WITHIN LINES OF COMMENTS.
> Python likes pure ASCII ...

Odd... I've always been under the impression it supported other charsets
pretty well. A test script is attached to demonstrate what _should_
work.

It works fine here when run as ./test.py, when imported as a module, 
and when run from Scribus using Execute Script. It fails when I try to
import it as a module into Scribus. It's possible the scripter needs to
do something to tell the interpreter that it should treat input as utf-8
- I'll have a look if I get the chance.

This may be of interest:
http://www.python.org/peps/pep-0263.html

> > So I finally could change the script to the values I needed, but the 
> > month March (in German März) must stay Maerz - a bit ugly. 
> Try 'M\xe4rz' for 'März' ...
> It works in so called long strings, with the hexadezimal (ascii-)code 
> written \x?? (here e4) or with the octal code \??? (here 344).
> Hope the MONTHs in the script are long strings ...

Yep. I had no problem creating a short script to print the encoded
strings (see attached simple test) so that's a workaround for now.

It looks to me like it may be necessary to go over the scripting
interface and examine assumptions about unicode vs encoded text. Yay.
The C API seems to handle them fairly differently right now :-(

The Python folks are planning on entirely unifying unicode and encoded
text handling soon, but "soon" is >v2.4 so it'll be a while before that
feature can be assumed to be present :-(

I should note that all my comments here assume python 2.3 or python 2.4
is in use.

--
Craig Ringer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 219 bytes
Desc: not available
Url : http://nashi.altmuehlnet.de/pipermail/scribus/attachments/20041028/f10a1b9d/attachment.py 



More information about the scribus mailing list