pombreda / gcalcli

Automatically exported from code.google.com/p/gcalcli
0 stars 0 forks source link

unicode error on "calm" output #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. can@proplyd:~/vc/svn/gcalcli-read-only$ ./gcalcli calm

What is the expected output? What do you see instead?
I expeect to see a calendar display but i get a partial calendar display
with a python traceback.

What version of the product are you using? On what operating system?
latest svn. debian lenny, gnome-terminal, bash, proper unicode setup,
pytohn 2.4

Please provide any additional information below.
here is the output
can@proplyd:~/vc/svn/gcalcli-read-only$ ./gcalcli calm

+----------+----------+----------+----------+----------+----------+----------+
|April 2008                                                                  |
+----------+----------+----------+----------+----------+----------+----------+
|Sunday    |Monday    |Tuesday   |Wednesday |Thursday  |Friday    |Saturday  |
+----------+----------+----------+----------+----------+----------+----------+
|          |          | 1        | 2        | 3        | 4        | 5        |
|          |          |          |          |          |          |          |
|          |          |5:00pm    |1:00pm    |9:00am    |9:00am    |5:00pm LAW|
|          |          |COMP      |COMP      |COMP      |COMP      |252       |
|          |          |232.01    |322.01    |461.01/011|322.01/012|Dolapdere |
|          |          |          |D.133 (50)|DZ 20 (21)|DZ 23 (29)|DZ 40     |
|          |          |          |          |          |          |Invigilato|
|          |          |          |          |12:00pm   |3:00pm    |r         |
Traceback (most recent call last):
  File "./gcalcli", line 1114, in ?
    DoooooItHippieMonster()
  File "./gcalcli", line 1079, in DoooooItHippieMonster
    gcal.CalQuery(args[0])
  File "./gcalcli", line 819, in CalQuery
    self._GraphEvents(cmd, start, count, eventList)
  File "./gcalcli", line 594, in _GraphEvents
    PrintMsg(CLR_NRM(), line + "\n")
  File "./gcalcli", line 207, in PrintMsg
    sys.stdout.write(msg)
  File "/usr/lib/python2.4/codecs.py", line 178, in write
    data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 178:
ordinal not in range(128)

and
can@proplyd:~/vc/svn/gcalcli-read-only$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Original issue reported on code.google.com by canbu...@gmail.com on 28 Apr 2008 at 4:06

GoogleCodeExporter commented 9 years ago
This is because gcalcli want to split long string into multiple lines during 
layout. 
And it break the string in the middle of a unicode character, thus python 
complaint 
incomplete unicode character.

Original comment by kuang...@gmail.com on 8 May 2008 at 5:51

GoogleCodeExporter commented 9 years ago
Attach the patch.

It fixes _GetCutIndex() and _GraphEvents() for utf-8 text.

Original comment by kuang...@gmail.com on 10 May 2008 at 11:09

Attachments:

GoogleCodeExporter commented 9 years ago
The patch didn't help. I have the same error running "gcalcli calm" on Cygwin,
Windows XP, Python 2.5 installed under Cygwin:

Traceback (most recent call last):
  File "./gcalcli", line 1132, in <module>
    DoooooItHippieMonster()
  File "./gcalcli", line 1097, in DoooooItHippieMonster
    gcal.CalQuery(args[0])
  File "./gcalcli", line 837, in CalQuery
    self._GraphEvents(cmd, start, count, eventList)
  File "./gcalcli", line 599, in _GraphEvents
    cut = self._GetCutIndex(weekEventStrings[j], self.calWidth)
  File "./gcalcli", line 432, in _GetCutIndex
    if (wlen(string) <= width):
  File "./gcalcli", line 72, in wlen
    for c in unicode(text):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 13: 
ordinal not
in range(128)

Original comment by pavelvi...@gmail.com on 4 Jun 2008 at 5:33

GoogleCodeExporter commented 9 years ago
Patch didn't hep here either. Running gcalcli on OSX with python 2.5.

Original comment by h3L93.ph1l1pp@gmail.com on 27 Jun 2008 at 6:02

GoogleCodeExporter commented 9 years ago
Same here. Linux with python 2.5.2

Original comment by m.fellin...@gmail.com on 2 Jul 2008 at 2:46

GoogleCodeExporter commented 9 years ago
Still no fix?

Original comment by gerolf.z...@gmail.com on 20 Nov 2008 at 11:36

GoogleCodeExporter commented 9 years ago
It's the encoding again :( The bug occurs, when a strange character äöüß or 
something
else is used somewhere. So one should insert .decode("utf") s  everywhere, 
until it
works again.

for example in my case 

in gcalcli line 626 do:

'  %-7s  %s\n' % (tmpTimeStr, event.title.text.decode("utf")))

/G

Original comment by gerolf.z...@gmail.com on 20 Nov 2008 at 11:52

GoogleCodeExporter commented 9 years ago
Here is a simple patch that fixes the UnicodeDecodeError.

Original comment by marcus.n...@gmail.com on 27 Oct 2010 at 8:37

Attachments:

GoogleCodeExporter commented 9 years ago
How or where to I apply this patch?
Will it help me?
This is what I get
+----------+----------+----------+----------+----------+----------+----------+
|14        |15        |16        |17        |18 ***    |19        |20        |
|          |          |          |          |          |          |          |
|3:00pm    |          |          |4:00pm Jen|12:00am   |12:00am   |12:00am   |
|Adam's    |          |          |over for  |Forecast  |Forecast  |Forecast  |
|b-day     |          |          |supper    |for       |for       |for       |
|party     |          |          |          |Edmonton, |Edmonton, |Edmonton, |
|          |          |          |6:30pm    |Alberta   |Alberta   |Alberta   |
Traceback (most recent call last):
  File "/usr/local/bin/gcalcli", line 1114, in <module>
    DoooooItHippieMonster()
  File "/usr/local/bin/gcalcli", line 1079, in DoooooItHippieMonster
    gcal.CalQuery(args[0])
  File "/usr/local/bin/gcalcli", line 819, in CalQuery
    self._GraphEvents(cmd, start, count, eventList)
  File "/usr/local/bin/gcalcli", line 594, in _GraphEvents
    PrintMsg(CLR_NRM(), line + "\n")
  File "/usr/local/bin/gcalcli", line 207, in PrintMsg
    sys.stdout.write(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/codecs.py", line 351, in write
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 133: 
ordinal not in range(128)

Original comment by cksie...@gmail.com on 19 Nov 2010 at 3:36

GoogleCodeExporter commented 9 years ago

Original comment by eda...@insanum.com on 31 Jul 2011 at 5:24