If you’re doing development of software in China, you’ll almost certainly know you’re way around encodings. If you don’t, you better learn quick 🙂
If you’re using subversion to manage your software version control, then you’ll probably also want to use Trac access an easy to navigate, visual, color view of your source code repository. Additionally, you’ll probably want to use svn-mailer to send out notification messages to the entire development team about each new change as it comes up. Well, if on your Ubuntu box you just do an:
$ sudo aptitude install svnmailer
You’ll be unpleasantly surprised that you’re messages get mutilated… Additionally, Trac URLs is only supported in svn-mailer 1.10 and later. You might install the svnmailer package just to take care of any dependancies, but you’ll want to download the source version and install it too (at least until later 2007 when I would expect the svnmailer package to be in the Ubuntu base distribution).
wget http://storage.perlig.de/svnmailer/svnmailer-1.1.0-dev-r1373.tar.bz2 tar -jxvf svnmailer-*.bz2 cd svnmailer-* && sudo python setup.py install
Next, you’ll want to create an svnmailer.conf file that looks something like this:
[general] smtp_host = localhost:25 config_charset = utf-8 [defaults] commit_subject_prefix = [svn] commit: apply_charset_property = yes show_applied_charset = yes from_addr = firstname.lastname@example.org to_addr = email@example.com firstname.lastname@example.org email@example.com browser_base_url = Trac http://example.org/trac/example/browser/ mail_transfer_encoding = 8bit
Note that if you specify a mail_transfer_encoding other than 8bit, you’re messages will almost certainly get mangled… But try it if you like. Note that if you we’re seeing the equals sign (=) being replaced with =3D=3D=3D=3D… in your svn-mailer files, setting the mailer_transfer_encoding to 8bit will also fix that!
Next, you’ll want to cd inside of the root of a copy of your svn checkout and run:
svn pedit svnmailer:content-charset .
(Note the “.” at the end of this line) Next, a window of vim or some other editor should come up, in which you probably want to type:
* = utf-8
That’s it. Save and quit out of your editor, then svn ci the root directory of your checkout. Afterward, you should see that from svn-mailer’s prospective you’re files are by default encoded with UTF-8. You can change the encoding for any subdirectory, while will be inherited by descendants if you need to use some other encoding. You can also write the encoding for a specific file with:
svn pset svnmailer:content-charset utf-8 somefile
p>That’s it. You can read more about the svnmailer character set options in the apply_charset_property section of the svnmailer documentation.