Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getttext defaults with unicode #36692

Closed
anglerud mannequin opened this issue Jun 3, 2002 · 5 comments
Closed

getttext defaults with unicode #36692

anglerud mannequin opened this issue Jun 3, 2002 · 5 comments
Assignees

Comments

@anglerud
Copy link
Mannequin

anglerud mannequin commented Jun 3, 2002

BPO 563915
Nosy @malemburg, @loewis, @warsaw

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/warsaw'
closed_at = <Date 2002-06-13.20:03:32.000>
created_at = <Date 2002-06-03.15:09:40.000>
labels = ['expert-unicode']
title = 'getttext defaults with unicode'
updated_at = <Date 2002-06-13.20:03:32.000>
user = 'https://bugs.python.org/anglerud'

bugs.python.org fields:

activity = <Date 2002-06-13.20:03:32.000>
actor = 'barry'
assignee = 'barry'
closed = True
closed_date = None
closer = None
components = ['Unicode']
creation = <Date 2002-06-03.15:09:40.000>
creator = 'anglerud'
dependencies = []
files = []
hgrepos = []
issue_num = 563915
keywords = []
message_count = 5.0
messages = ['11041', '11042', '11043', '11044', '11045']
nosy_count = 4.0
nosy_names = ['lemburg', 'loewis', 'barry', 'anglerud']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue563915'
versions = ['Python 2.2']

@anglerud
Copy link
Mannequin Author

anglerud mannequin commented Jun 3, 2002

When using gettext, and a token is not translated, for
example:
print _('Foo')
the output will be 'Foo', as expected. 
However, if that entry is:
print _(u'Foo')
we get:
Traceback (most recent call last):
  File "./translation.py", line 12, in ?
    print _(u'Foo')
  File "/usr/lib/python2.2/gettext.py", line 195, in
ugettext
    return unicode(tmsg, self._charset)
TypeError: decoding Unicode is not supported

@anglerud anglerud mannequin closed this as completed Jun 3, 2002
@anglerud anglerud mannequin assigned warsaw Jun 3, 2002
@anglerud anglerud mannequin added the topic-unicode label Jun 3, 2002
@anglerud anglerud mannequin closed this as completed Jun 3, 2002
@anglerud anglerud mannequin assigned warsaw Jun 3, 2002
@anglerud anglerud mannequin added the topic-unicode label Jun 3, 2002
@loewis
Copy link
Mannequin

loewis mannequin commented Jun 4, 2002

Logged In: YES
user_id=21627

I'm not sure this is a bug: they keys in a message catalog
are really byte strings. So it is an error to use Unicode
strings as arguments to _.

@malemburg
Copy link
Member

Logged In: YES
user_id=38388

Barry will know what to do...

@warsaw
Copy link
Member

warsaw commented Jun 4, 2002

Logged In: YES
user_id=12800

I agree with Martin, you shouldn't be passing unicode
strings to ugettext(). I don't think it's worth doing a
type test in ugettext(); maybe we simply need to improve the
documentation?

@warsaw
Copy link
Member

warsaw commented Jun 13, 2002

Logged In: YES
user_id=12800

I will shortly post a patch that clarifies the documentation
to describe the GNU gettext recommendation that the source
message string should be us-ascii. As that fixes things in
my mind, I'm closing this bug report.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants