okay well, it seems that moving the strings around solved the problem.
I just put them in a js variable and used that in the js code. Also
the UnicodeWarning disappeared which leads me to think the two were
connected.
This is very strange indeed...

On Feb 16, 6:38 pm, zaf <tom.zaff...@gmail.com> wrote:
> Also I'm getting this warning when I collect strings on my js files.
>
> /usr/lib/python2.5/site-packages/TurboGears-1.1-py2.5.egg/turbogears/
> command/i18n.py:469: UnicodeWarning: Unicode equal comparison failed
> to convert both arguments to Unicode - interpreting them as being
> unequal
>
> Don't know if it's related...
> Tom
> On Feb 16, 5:53 pm, zaf <tom.zaff...@gmail.com> wrote:
>
> > Okay well here's a paste of JS code that fail :http://pastebin.com/m1e7207c6
>
> > What's very weird, is that after some debugging,I realized line 10
> > failed but not the others and only one string in line 10 actually
> > fails.
>
> > I did this to figure out the problem : (this is in turbogears/command/
> > i18n.py, line 483)
>
> >     def _write_potfile_entries(self, potfile, messages):
> >         if messages:
> >             fd = open(potfile, 'at+')
> >             for linenumber, fname, text in messages:
> >                 if text == '':
> >                     continue
> >                 print 'Original, ',type(text), text, fname, linenumber
> >                 text = catalog.normalize(text.encode('utf-8'))
> >                 fd.write('#: %s:%s\n' % (fname, linenumber))
> >                 fd.write('msgid %s\n' % text)
> >                 fd.write('msgstr ""\n\n')
> >             fd.close()
>
> >  and this is the output I get for line 10 :
>
> > Original,  <type 'unicode'>  clé(s) envoyée(s). cinego/static/
> > javascript/film.js 222
>
> > Original,  <type 'str'> Afficher le détail cinego/static/javascript/
> > film.js 222
>
> > I don't understand why one string would be typed as string and another
> > as unicode.
> > I'm guessing it's got to do with my typing of the strings but I really
> > don't see what's wrong.
> > Tom
>
> > On Feb 16, 5:35 pm, "Diez B. Roggisch" <de...@web.de> wrote:
>
> > > On Tuesday 16 February 2010 17:09:42 zaf wrote:
>
> > > > Hi,
> > > > A while ago I had difficulties with non-ascii characters in strings in
> > > > JS files.
>
> > > > Basically everytime I used the tg-admin i18n collect command, if I had
> > > > a javascript file containing non-ascii characters, it would give me a
> > > > unicode error.
>
> > > > This was apparently supposed to be fixed here :
> > > >http://trac.turbogears.org/changeset/6645.
>
> > > > Now I've been trying to collect my strings using tg-admin collect --js-
> > > > encoding utf-8 but I'm getting the following error :
> > > > Traceback (most recent call last):
> > > >   File "/usr/bin/tg-admin", line 8, in <module>
> > > >     load_entry_point('TurboGears==1.1', 'console_scripts', 'tg-admin')
> > > > ()
> > > >   File "/usr/lib/python2.5/site-packages/TurboGears-1.1-py2.5.egg/
> > > > turbogears/command/base.py", line 416, in main
> > > >     command.run()
> > > >   File "/usr/lib/python2.5/site-packages/TurboGears-1.1-py2.5.egg/
> > > > turbogears/command/i18n.py", line 150, in run
> > > >     self.scan_source_files()
> > > >   File "/usr/lib/python2.5/site-packages/TurboGears-1.1-py2.5.egg/
> > > > turbogears/command/i18n.py", line 336, in scan_source_files
> > > >     self.scan_js_files(tmp_potfile, js_files)
> > > >   File "/usr/lib/python2.5/site-packages/TurboGears-1.1-py2.5.egg/
> > > > turbogears/command/i18n.py", line 481, in scan_js_files
> > > >     self._write_potfile_entries(potfile, messages)
> > > >   File "/usr/lib/python2.5/site-packages/TurboGears-1.1-py2.5.egg/
> > > > turbogears/command/i18n.py", line 489, in _write_potfile_entries
> > > >     text = catalog.normalize(text.encode('utf-8'))
> > > > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> > > > 13: ordinal not in range(128)
>
> > > > So if there is someone around here who knows where the problem is and
> > > > how I can fix it, it would be very cool. Removing the non-ascii
> > > > characters from my js strings is not really an option as there are a
> > > > LOT of them.
>
> > > Can you show at least an example of one such files?
>
> > > Diez

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to turboge...@googlegroups.com.
To unsubscribe from this group, send email to 
turbogears+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to