mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
fix encoding of user name and email address
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16379 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cb0b0bb799
commit
5843e6bd7f
@ -295,9 +295,9 @@ void LyXRC::setDefaults() {
|
|||||||
use_converter_cache = false;
|
use_converter_cache = false;
|
||||||
converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
|
converter_cache_maxage = 6 * 30 * 24 * 3600; // 6 months
|
||||||
|
|
||||||
user_name = support::user_name();
|
user_name = to_utf8(support::user_name());
|
||||||
|
|
||||||
user_email = support::user_email();
|
user_email = to_utf8(support::user_email());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,15 +34,15 @@ using std::string;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace support {
|
namespace support {
|
||||||
|
|
||||||
string const user_name()
|
docstring const user_name()
|
||||||
{
|
{
|
||||||
#if defined (_WIN32)
|
#if defined (_WIN32)
|
||||||
|
|
||||||
char name[UNLEN + 1];
|
char name[UNLEN + 1];
|
||||||
DWORD size = UNLEN + 1;
|
DWORD size = UNLEN + 1;
|
||||||
if (!GetUserName(name, &size))
|
if (!GetUserName(name, &size))
|
||||||
return lyx::to_utf8(_("Unknown user"));
|
return _("Unknown user");
|
||||||
return name;
|
return from_local8bit(name);
|
||||||
#else
|
#else
|
||||||
struct passwd * pw(getpwuid(geteuid()));
|
struct passwd * pw(getpwuid(geteuid()));
|
||||||
BOOST_ASSERT(pw);
|
BOOST_ASSERT(pw);
|
||||||
@ -50,17 +50,17 @@ string const user_name()
|
|||||||
string name = pw->pw_gecos;
|
string name = pw->pw_gecos;
|
||||||
if (name.empty())
|
if (name.empty())
|
||||||
name = pw->pw_name;
|
name = pw->pw_name;
|
||||||
return name;
|
return from_local8bit(name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string const user_email()
|
docstring const user_email()
|
||||||
{
|
{
|
||||||
string email = getEnv("EMAIL_ADDRESS");
|
string email = getEnv("EMAIL_ADDRESS");
|
||||||
if (email.empty())
|
if (email.empty())
|
||||||
email = getEnv("EMAIL");
|
email = getEnv("EMAIL");
|
||||||
return email;
|
return from_local8bit(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace support
|
} // namespace support
|
||||||
|
@ -12,17 +12,17 @@
|
|||||||
#ifndef USERINFO_H
|
#ifndef USERINFO_H
|
||||||
#define USERINFO_H
|
#define USERINFO_H
|
||||||
|
|
||||||
#include <string>
|
#include "support/docstring.h"
|
||||||
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace support {
|
namespace support {
|
||||||
|
|
||||||
/// return the current user's real name
|
/// return the current user's real name
|
||||||
std::string const user_name();
|
docstring const user_name();
|
||||||
|
|
||||||
/// return the current user's e-mail address
|
/// return the current user's e-mail address
|
||||||
std::string const user_email();
|
docstring const user_email();
|
||||||
|
|
||||||
} // namespace support
|
} // namespace support
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
Loading…
Reference in New Issue
Block a user