mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +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;
|
||||
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 support {
|
||||
|
||||
string const user_name()
|
||||
docstring const user_name()
|
||||
{
|
||||
#if defined (_WIN32)
|
||||
|
||||
char name[UNLEN + 1];
|
||||
DWORD size = UNLEN + 1;
|
||||
if (!GetUserName(name, &size))
|
||||
return lyx::to_utf8(_("Unknown user"));
|
||||
return name;
|
||||
return _("Unknown user");
|
||||
return from_local8bit(name);
|
||||
#else
|
||||
struct passwd * pw(getpwuid(geteuid()));
|
||||
BOOST_ASSERT(pw);
|
||||
@ -50,17 +50,17 @@ string const user_name()
|
||||
string name = pw->pw_gecos;
|
||||
if (name.empty())
|
||||
name = pw->pw_name;
|
||||
return name;
|
||||
return from_local8bit(name);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
string const user_email()
|
||||
docstring const user_email()
|
||||
{
|
||||
string email = getEnv("EMAIL_ADDRESS");
|
||||
if (email.empty())
|
||||
email = getEnv("EMAIL");
|
||||
return email;
|
||||
return from_local8bit(email);
|
||||
}
|
||||
|
||||
} // namespace support
|
||||
|
@ -12,17 +12,17 @@
|
||||
#ifndef USERINFO_H
|
||||
#define USERINFO_H
|
||||
|
||||
#include <string>
|
||||
#include "support/docstring.h"
|
||||
|
||||
|
||||
namespace lyx {
|
||||
namespace support {
|
||||
|
||||
/// return the current user's real name
|
||||
std::string const user_name();
|
||||
docstring const user_name();
|
||||
|
||||
/// return the current user's e-mail address
|
||||
std::string const user_email();
|
||||
docstring const user_email();
|
||||
|
||||
} // namespace support
|
||||
} // namespace lyx
|
||||
|
Loading…
Reference in New Issue
Block a user