Wrong domain encoding set by _get_codeset() if using direct calls to domain based methods
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
php-gettext |
New
|
Undecided
|
Unassigned |
Bug Description
Problem:
after initial setup, a direct call to _dgettext (or to the others domain based methods) results in data being encoded with default ini_get(
Ex:
$domain = 'MyGettextPoMoF
_bindtextdomain
_bind_textdomai
_setlocale(
echo _dgettext(
result in: message-
The problem is that the the parameter $domain is never passed to _get_codeset() function from the call inside the _encode() function called from _dgettext() (and all others d functions).
Actual code extract (v1.0.12):
function _get_codeset(
global $text_domains, $default_domain, $LC_CATEGORIES;
if (!isset($domain)) $domain = $default_domain;
return (isset(
}
function _encode($text) {
$target_encoding = _get_codeset();
if (function_
$source_
if ($source_encoding != $target_encoding)
$text = mb_convert_
}
return $text;
}
function _dngettext($domain, $singular, $plural, $number) {
$l10n = _get_reader(
return _encode(
}
Fix:
function _get_codeset(
global $text_domains, $default_domain, $LC_CATEGORIES;
if (!isset($domain)) $domain = $default_domain;
return (isset(
}
function _encode(
$target_encoding = _get_codeset(
if (function_
$source_
if ($source_encoding != $target_encoding)
$text = mb_convert_
}
return $text;
}
function _dgettext($domain, $msgid) {
$l10n = _get_reader(
return _encode(
}
function _dngettext($domain, $singular, $plural, $number) {
$l10n = _get_reader(
return _encode(
}
and so on for _dcgettext, _dcngettext, _dcpgettext, _dnpgettext, _dcnpgettext.
description: | updated |
description: | updated |