Closed GoogleCodeExporter closed 9 years ago
OH bother! well who doesn't have uniçode problems. I'll apply the patch, but
want to
know what your use case was so i can make a unittest for it.
Original comment by justquick
on 20 Apr 2009 at 4:53
The testcase can look as follows:
g = VerticalBarGroup( [[10], [20], [30]], encoding = 'text')
g.label(u'šýŽěůčář...')
g.legend(u'šýŽěůčář...', ...)
the letters come from [http://en.wikipedia.org/wiki/Czech_alphabet czech
alphbet].
example of czech keyboard layout can be found
[http://www.terena.org/activities/multiling/ml-mua/test/kbd-all.html here]
BTW I'm using slightly older version (August/September 2008) of your library for
my [http://code.google.com/p/parliament-poll-stats/ project]. I like your
library
very much. Thanks for a nice job.
Original comment by anedvedi...@gmail.com
on 20 Apr 2009 at 11:40
I applied your patch and it only kinda worked. Now it does proper unicoding on
the
legend, but not the label: http://yfrog.com/2qczechandunicodep . If you see
anything
else, let me know otherwise im gonna see what i can do
Original comment by justquick
on 20 Apr 2009 at 4:03
May be the urllib.quote should not be there, and leave the orignal line.
I will attach my GChart.py, which I've patched some time ago. My patched source
is attached.
I've tried to patch the current version, diff follows:
Index: GChart.py
===================================================================
--- GChart.py (revision 177)
+++ GChart.py (working copy)
@@ -134,9 +134,9 @@
args are of the form <label 1>,...,<label n>
APIPARAM: chxl
"""
- label = '|'.join(map(str,args))
+ label = u'|'.join(map(unicode,args))
id = len(self.labels)
- self.labels.append( str('%d:|%s'%(id,label)).replace('None','') )
+ self.labels.append( unicode(u'%d:|%s'%(id,label)).replace(u'None',u'')
)
return self.parent
def position(self, *args):
@@ -351,13 +351,10 @@
call each time for each dataset
APIPARAM: chl
"""
- if self['cht'] == 'qr':
- self['chl'] = ''.join(map(str,args))
- self['chl'] = ''.join(map(QUOTE,args))
- else:
- map(unicode,args)
- self['chl'] = '|'.join(map(QUOTE,map(unicode,args)))
- # self['chl'] = '|'.join(args)
+ if self.data['cht'] == 'qr':
+ self.data['chl'] = ''.join(map(urllib.quote,args))
+ else:
+ self.data['chl'] = '|'.join(args)
return self
def legend(self, *args):
@@ -366,8 +363,7 @@
call each time for each dataset
APIPARAM: chdl
"""
- self['chdl'] = '|'.join(args)
- self['chdl'] = u'|'.join(args)
+ self.data['chdl'] = u'|'.join(args)
return self
def legend_pos(self, pos):
Original comment by anedvedi...@gmail.com
on 20 Apr 2009 at 5:58
Attachments:
Your patches are on the right track, but i refuse to use unicode/u'' since im
making
the wrapper work for both py2k and py3k. I have committed the changes
accordingly for
the unicode problems. Take a look at
[http://code.google.com/p/google-chartwrapper/source/browse/trunk/GChartWrapper/
testing.py
GChartWrapper.testing.czech_and_unicode:552] and see if that use case fits well
with
what you were trying. Run `python GChartWrapper/tests.py save` to save the image
output for review.
Original comment by justquick
on 21 Apr 2009 at 2:26
> Your patches are on the right track, but i refuse to use unicode/u'' since im
> making the wrapper work for both py2k and py3k. I have committed the changes
> accordingly for the unicode problems. Take a look at
Yes, it makes perfect sense. I'm going to keep the version I have in my
project right now. It's django, which is running on top of Python 2.5. Once
it everything will be switched to python 3.0 I'll move to up to date
pyChartWrapper.
thanks
sasha
Original comment by anedvedi...@gmail.com
on 22 Apr 2009 at 11:49
OK, but you are still missing the point. The wrapper will handle both py2 and
py3 as
it stands now. I am going to update a couple things that the google people
changed
and hopefully will release v0.8 of the wrapper in may. I suggest you use it
when it
comes out, i have done a bit of work on the django end too.
Original comment by justquick
on 22 Apr 2009 at 5:32
I see. I will wait for 0.8 version and give it a try. If there will be
no problems, I'll switch to 0.8.
Original comment by anedvedi...@gmail.com
on 22 Apr 2009 at 8:57
Original issue reported on code.google.com by
anedvedi...@gmail.com
on 17 Apr 2009 at 7:52