[Scribus] OT: Non-ASCII Chars in Python

VANĚK Petr Petr.VANEK
Wed Oct 6 09:50:09 CEST 2004


> >> -----Original Message-----
> >> From: scribus-bounces at nashi.altmuehlnet.de
> [mailto:scribus-bounces at nashi.altmuehlnet.de] On Behalf Of 
> Dr. Elmar Jobs
> >> Sent: Tuesday, October 05, 2004 6:29 AM
> >> 
> >> I tried the calender script recently posted (nice work, thanks)
> >> and wanted to change the Month-Names into German. But the Python
> >> interpreter bails out with an error.
> >> 
> >> Are there any tricks to use non ASCII characters in python
> >> scripts?
> 
> I'm not sure how much of the problem is python and how much is
> Scribus.  Put this into a file and run it at a command prompt:
> 
> #!/usr/bin/python
> # -*- coding: UTF-8 -*-
> MonthList = ['Januar', 'Februar', 'M'+u'\xe4'+'rz']
> for Month in range(3):
> 	print MonthList[Month]
> 
> It should display the "a" in "Marz" with an umlaut (diaeresis)
> over it.
> 
> But when run as a Scribus script, the array assignment line is
> where it fails.  I may be missing something obvious.  I haven't
> really needed to deal with non-ASCII characters much so I may
> be doing something fundamentally wrong.

I'm sure it's Python related. You can use

import sys
sys.setappdefaultencoding('utf8') # i'm not sure if it's exactly named like that - search web or py.cz ;)

after p2.2 (hope that) to remove this error.




More information about the scribus mailing list