Notices


Reply
Thread Tools
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#1021
Originally Posted by Z3tor View Post
Script works now, but scandic letters in code give errors. How to set encoding for finnish?
The output should already be encoded correctly with the .encode('utf-8') in the end. Worked for my finnish entries as far as I remember. What is the error exactly?
 
Win7Mac's Avatar
Community Council | Posts: 664 | Thanked: 1,648 times | Joined on Apr 2012 @ Hamburg
#1022
Originally Posted by thp View Post
Will be part of the next release.
When that happens, probably you could ask for confirmation of restoring libsysuid-screenlock-nokia.css during update process? Or simply not replace the actual one and put that as an option within Billboard?
That would actually be great!

I'm sure this has been asked before, but I'm not aware of a solution:
Is there a chance to dimm standby screen?
__________________
Nokia 5110 > 3310 > 6230 > N70 > N9 BLACK 64GB
Hildon Foundation Board member
Maemo Community e.V. co-creator, founder and director since Q4/2016
Current Maemo Community Council member
 
Posts: 58 | Thanked: 19 times | Joined on Jan 2012 @ Finland
#1023
Originally Posted by slarti View Post
The output should already be encoded correctly with the .encode('utf-8') in the end. Worked for my finnish entries as far as I remember. What is the error exactly?
The print line below gives me error about non ASCII chars, which are in this case the letter "ä". If they are replaced with "a", script runs without error.
Code:
if (datetime.now() + timedelta(days_ahead)) < events_list[0][0]:
        print ('Ei tapahtumia %s päivään' % (days_ahead)).encode('utf-8')
I did $ locale -a to see what locales are installed in my device, and get fi and fi_FI. I tried to modify code with encode('fi_FI.utf-8'), but no luck.
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#1024
Locale won't change a thing for whatever weird reason.

Try declaring the encoding by adding

#-*- coding: utf-8 -*-

after #!/usr/bin/python

and get rid of the .encode('utf-8') part everywhere. I think that will do the trick. If it does, let me know and I'll change it in github.

Last edited by slarti; 2013-10-30 at 13:57.
 
Posts: 58 | Thanked: 19 times | Joined on Jan 2012 @ Finland
#1025
Ok, now it works.... almost. Script works fully in terminal with scandic letters too, but in bb, it only prints output if there is no events in x days. So if event is found it does not get printed in bb, but in terminal it works. Weird
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#1026
Did you remove the .encode('utf-8') part everywhere?

Sorry to do this the difficult way, I don't have my half-broken N9 here.
 
Posts: 58 | Thanked: 19 times | Joined on Jan 2012 @ Finland
#1027
yes i removed them all. Weird how it fully works in terminal, but only partly in bb.
 
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#1028
I can't remember if there is a limitation to line length in BB. Try printing fewer things in the last line as a test. For example try:

print weekday,title

and see if that works. If it does, add more things and see what screws it up.
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,699 times | Joined on Nov 2011 @ Ängelholm, Sweden
#1029
declare text as unicode string:
Code:
u'Ei tapahtumia %s päivään'
__________________
Telegram | Openrepos | GitHub | Revolut donations
 
Posts: 58 | Thanked: 19 times | Joined on Jan 2012 @ Finland
#1030
Sorted it finally... Actually the line "print weekday, title, ..." needed .encode('utf-8') afterall to output in bb. And then again #-*- coding: utf-8 -*- is needed to print scandic letters.
 

The Following User Says Thank You to Z3tor For This Useful Post:
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 17:03.