You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
localeconv() does not encode returned strings #46279
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=Noneclosed_at=<Date2008-03-08.10:43:45.174>created_at=<Date2008-02-01.18:13:47.482>labels= ['extension-modules', 'type-bug']
title='localeconv() does not encode returned strings'updated_at=<Date2008-03-08.10:43:45.173>user='https://github.com/pitrou'
Some values in the dict returned by localeconv() may be non-ASCII
strings, yet they are not decoded according to the locale's character
set. This can be observed when the currency symbol is the euro sign:
localeconv() is defined in the _locale module, which has no knowledge of
the current encoding - but the locale module does. So we could redefine
localeconv() in locale as a wrapper, to do the proper encoding dance.
Here is a patch fixing the problem. Note however that it will make
localeconv() quite slower. Perhaps _locale.localeconv should grow an
encoding parameter instead.
loewis commented on Feb 1, 2008
loewismannequin
Mannequin
More actions
The locale module is completely broken; don't try to work around that
breakage. One option would be to remove it entirely.
Perhaps it is broken - it does look rather fragile - but are there any
plans to design a replacement?
loewis commented on Feb 2, 2008
loewismannequin
Mannequin
More actions
Perhaps it is broken - it does look rather fragile - but are there any
plans to design a replacement?
If people could contribute an ICU wrapper - that would be nice. However,
it's unlikely to happen. So I'll rather rewrite _locale to use wchar_t
functions, and give up on systems where these are not available, or
where wchar_t is not Unicode (not sure how to detect the latter case).
loewis commented on Mar 8, 2008
loewismannequin
Mannequin
More actions
I found now a way to fix this, by relying on wchar_t functions. It's
fixed in r61306
Activity
pitrou commentedon Feb 1, 2008
Some values in the dict returned by localeconv() may be non-ASCII
strings, yet they are not decoded according to the locale's character
set. This can be observed when the currency symbol is the euro sign:
localeconv() is defined in the _locale module, which has no knowledge of
the current encoding - but the locale module does. So we could redefine
localeconv() in locale as a wrapper, to do the proper encoding dance.
pitrou commentedon Feb 1, 2008
Here is a patch fixing the problem. Note however that it will make
localeconv() quite slower. Perhaps _locale.localeconv should grow an
encoding parameter instead.
loewis commentedon Feb 1, 2008
The locale module is completely broken; don't try to work around that
breakage. One option would be to remove it entirely.
pitrou commentedon Feb 1, 2008
Perhaps it is broken - it does look rather fragile - but are there any
plans to design a replacement?
loewis commentedon Feb 2, 2008
If people could contribute an ICU wrapper - that would be nice. However,
it's unlikely to happen. So I'll rather rewrite _locale to use wchar_t
functions, and give up on systems where these are not available, or
where wchar_t is not Unicode (not sure how to detect the latter case).
loewis commentedon Mar 8, 2008
I found now a way to fix this, by relying on wchar_t functions. It's
fixed in r61306