From: Brian Warner <warner@lothar.com>
Date: Sat, 20 Sep 2008 18:37:13 +0000 (-0700)
Subject: BASEDIR/nickname is now UTF-8 encoded
X-Git-Url: https://git.rkrishnan.org/%5B/%5D%20/file/URI:LIT:krugkidfnzsc4/%3C?a=commitdiff_plain;h=063f85d15709bf698bef75f47ddaa22178eeb16c;p=tahoe-lafs%2Ftahoe-lafs.git

BASEDIR/nickname is now UTF-8 encoded
---

diff --git a/docs/configuration.txt b/docs/configuration.txt
index a7487a01..4826615a 100644
--- a/docs/configuration.txt
+++ b/docs/configuration.txt
@@ -22,7 +22,8 @@ attach a client to that grid
 
 nickname (optional): The contents of this file will be displayed in
 management tools as this node's "nickname". If the file doesn't exist, the
-nickname will be set to "<unspecified>".
+nickname will be set to "<unspecified>". This file shall be a UTF-8 encoded
+unicode string.
 
 webport (optional): This controls where the client's webserver should listen,
 providing filesystem access as defined in webapi.txt . This file contains a
diff --git a/src/allmydata/client.py b/src/allmydata/client.py
index 850af9fa..cb800a81 100644
--- a/src/allmydata/client.py
+++ b/src/allmydata/client.py
@@ -65,9 +65,11 @@ class Client(node.Node, testutil.PollMixin):
         node.Node.__init__(self, basedir)
         self.started_timestamp = time.time()
         self.logSource="Client"
-        self.nickname = self.get_config("nickname")
-        if self.nickname is None:
-            self.nickname = "<unspecified>"
+        nickname_utf8 = self.get_config("nickname")
+        if nickname_utf8:
+            self.nickname = nickname_utf8.decode("utf-8")
+        else:
+            self.nickname = u"<unspecified>"
         self.init_introducer_client()
         self.init_stats_provider()
         self.init_lease_secret()
diff --git a/src/allmydata/introducer/client.py b/src/allmydata/introducer/client.py
index 4b9484f9..085e0ccc 100644
--- a/src/allmydata/introducer/client.py
+++ b/src/allmydata/introducer/client.py
@@ -91,7 +91,7 @@ class IntroducerClient(service.Service, Referenceable):
         self._tub = tub
         self.introducer_furl = introducer_furl
 
-        self._nickname = nickname
+        self._nickname = nickname.encode("utf-8")
         self._my_version = my_version
         self._oldest_supported = oldest_supported