From 661405723930c64ca20fbb8191b6772cef919ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Wei=C3=9F?= Date: Wed, 11 May 2011 14:51:29 +0200 Subject: bcfg2: Convert specification from Unicode to UTF-8 The client receives the configuration specification as a Unicode string and then hands it over to the XML() function, which expects a UTF-8 encoded string. Therefore, the configuration specification is now converted to UTF-8. Resolves ticket #1009. --- src/sbin/bcfg2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 7f7d8f5c6..996d773ff 100755 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -243,7 +243,7 @@ class Client: raise SystemExit(1) try: - rawconfig = proxy.GetConfig() + rawconfig = proxy.GetConfig().encode('UTF-8') except xmlrpclib.Fault: self.logger.error("Failed to download configuration from Bcfg2") raise SystemExit(2) -- cgit v1.2.3-1-g7c22 From 85d52b2426b0f980e1b42ec8f90c888bbf68ce54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Wei=C3=9F?= Date: Thu, 19 May 2011 23:08:48 +0200 Subject: Revert "bcfg2: Write cached config using encoding from Options.py" This reverts commit 5d69ff7e966c4ffa911c78d11a6879b48e90aef8. As the "rawconfig" variable now holds a UTF-8 encoded string, it would have to be decoded before re-encoding it using a different encoding. However, the cached configuration shouldn't be written using a non-UTF-8 encoding anyway, as "bcfg2 -f " currently doesn't accept any other encodings. (If this is to be changed, the XML encoding declaration of the configuration would have to be adjusted accordingly.) --- src/sbin/bcfg2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 996d773ff..eb41af640 100755 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -252,7 +252,7 @@ class Client: if self.setup['cache']: try: - open(self.setup['cache'], 'w').write(rawconfig.encode(self.setup['encoding'])) + open(self.setup['cache'], 'w').write(rawconfig) os.chmod(self.setup['cache'], 33152) except IOError: self.logger.warning("Failed to write config cache file %s" % -- cgit v1.2.3-1-g7c22