]> git.lyx.org Git - lyx.git/commitdiff
fix encoding of user name and email address
authorGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Fri, 22 Dec 2006 10:26:52 +0000 (10:26 +0000)
committerGeorg Baum <Georg.Baum@post.rwth-aachen.de>
Fri, 22 Dec 2006 10:26:52 +0000 (10:26 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16379 a592a061-630c-0410-9148-cb99ea01b6c8

src/lyxrc.C
src/support/userinfo.C
src/support/userinfo.h

index 00aeb0b56cd25758565120877b6633bb9085dd66..955ba1ac6bd68000d2f807793993b7a8280488e8 100644 (file)
@@ -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());
 }
 
 
index bc40829dbf86d73fe2cedb6432d8062284253ed2..fec136d1e2bd77e768803807e9e4eff55b30143b 100644 (file)
@@ -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
index 6c103cd722d85f4732f7d17dfa98ab610b7af821..4556618920a64e801b9865c23c23587be99c2eed 100644 (file)
 #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