On 12/11/06, Alagu Madhu <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
>
> i18n/
>
> en:
>
> msgid "Hello"
> msgstr "Hello"
>
>
> ar(arabic):
>
> msgid "Hello"
> msgstr "عبدالرحمن عبدالله الصبيحي "
>
>
> I am getting the following error when I am using the unicode (utf-16)
> string.
>
>
> Error Traceback
> clear this
> clear this
> Module translate_demo.controllers.hello:17 in index
> <<          resp.write('Default: %s<br />' % _('Hello'))
>             for lang in ['en','ar']:
>                 h.set_lang(lang)
>                 resp.write("%s: %s<br />" % (h.get_lang(), _('Hello')))
>             return resp>>  h.set_lang(lang)
> Module pylons.helpers:93 in set_lang
> <<              raise LanguageError('Language catalog %s not found' % \
>                                     os.path.join(project_name,
> catalog_path))
>             translator = egg_translation(project_name,
> lang=catalog_path)
>             translator.pylons_lang = lang
>             registry.replace(pylons.translator, translator)>>
> translator = egg_translation(project_name, lang=catalog_path)
> Module pylons.i18n.translation:14 in egg_translation
> <<      """
>         class_ = GNUTranslations
>         return class_(resource_stream(domain, os.path.join(lang,
> '%s.mo' % domain)))>>  return class_(resource_stream(domain,
> os.path.join(lang, '%s.mo' % domain)))
> Module gettext:180 in __init__
> <<          self._fallback = None
>             if fp is not None:
>                 self._parse(fp)
>
>         def _parse(self, fp):>>  self._parse(fp)
> Module gettext:337 in _parse
> <<                  if self._charset:
>                         msg = unicode(msg, self._charset)
>                         tmsg = unicode(tmsg, self._charset)
>                     catalog[msg] = tmsg
>                 # advance to next entry in the seek tables
>     >>  tmsg = unicode(tmsg, self._charset)
> Module encodings.utf_8:16 in decode
> <<
>     def decode(input, errors='strict'):
>         return codecs.utf_8_decode(input, errors, True)
>
>     class IncrementalEncoder(codecs.IncrementalEncoder):>>  return
> codecs.utf_8_decode(input, errors, True)
> <type 'exceptions.UnicodeDecodeError'>: 'utf8' codec can't decode bytes
> in position 0-1: invalid data

I see that the subject says "Internationalization - utf-16", but the
error message says "'utf8' codec can't decode bytes in position 0-1:
invalid data".  Why don't you save the file in UTF-8?

By the way, sometimes you'll get errors like this if you save a file
in UTF-8 because your text editor will put a byte order mark (BOM) in
the text file, which is strange because UTF-8 doesn't need BOMs.

Ok, I hope my useless rambling was better than nothing.

-jj

-- 
http://jjinux.blogspot.com/

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to