Wednesday, January 15, 2014

svn Error converting entry in directory to UTF-8

Date: Sun, 20 Oct 2013 01:40:00 -0700 (PDT)
From: svn@j-www.local (Cron Daemon)
To: svn@j-www.local
Subject: Cron /usr/local/bin/svn update --username MYUSERNAME --password MYPASSWORD --non-interactive
+/www/web_hosting
X-Cron-Env:
X-Cron-Env:
X-Cron-Env:
X-Cron-Env:
X-Cron-Env:

Updating '/www/web_hosting':
svn: E000022: Error converting entry in directory '/www/web_hosting/www.example.com' to UTF-8
svn: E000022: Can't convert string from native encoding to 'UTF-8':
svn: E000022: G?\195?\169oM?\195?\169gA.html

Method 1:

Since the svn server stores everything in utf-8, and crontab is using /bin/sh shell. So, we need to add:

# vi /etc/crontab
*/5 * * * * svn export LC_ALL=en_US.UTF-8 && /usr/local/bin/svn update --username MYUSERNAME --password MYPASSWORD --non-interactive /www/web_hosting > /dev/null 2>&1

Method 2:
Run the command with tcsh:

# vi /etc/crontab
*/5 * * * * svn tcsh -c "/usr/local/bin/svn update --username MYUSERNAME --password MYPASSWORD --non-interactive /www/web_hosting" > /dev/null 2>&1

Make sure you do have following setting:

# vi ~svn/.cshrc
setenv LC_ALL en_US.UTF-8
setenv LANG en_US.UTF-8

No comments: