<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LiangXu Wang &#187; utf8</title>
	<atom:link href="http://wlx.westgis.ac.cn/tag/utf8/feed/" rel="self" type="application/rss+xml" />
	<link>http://wlx.westgis.ac.cn</link>
	<description>research of gis, rs, opensource.</description>
	<lastBuildDate>Wed, 28 Jul 2010 17:08:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>wordpress mu 1.3中的编码问题</title>
		<link>http://wlx.westgis.ac.cn/451/</link>
		<comments>http://wlx.westgis.ac.cn/451/#comments</comments>
		<pubDate>Sat, 03 Nov 2007 05:53:18 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[mu]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[utf8]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/451/</guid>
		<description><![CDATA[发现wordpress mu 升级到1.3版本了，对应到wordpress 2.3系列。其中，显著的功能就是默认的TAG支持了。但是升级后发现中文乱码，这时因为我的mysql数据库目前默认的编码还是latin1，而wordpress mu目前默认的编码是采用utf8了，因此需要进行修改。
有两种办法处理：
1、修改wordpress mu的代码
找到wp-inlcudes/wp-db.php文件，注释掉这两行：

//                if ( !empty($this-&#62;charset) &#38;&#38; version_compare(mysql_get_server_info(), '4.1.0', '&#62;=') )
//                        $this-&#62;query("SET NAMES '$this-&#62;charset'");

2、修改数据库编码，使其和你的wordpress编码相对应
比如，可以修改数据库的编码为utf8。
首先导出：
mysqldump [...]]]></description>
			<content:encoded><![CDATA[<p>发现wordpress mu 升级到1.3版本了，对应到wordpress 2.3系列。其中，显著的功能就是默认的TAG支持了。但是升级后发现中文乱码，这时因为我的mysql数据库目前默认的编码还是latin1，而wordpress mu目前默认的编码是采用utf8了，因此需要进行修改。</p>
<p>有两种办法处理：<br />
1、修改wordpress mu的代码<br />
找到wp-inlcudes/wp-db.php文件，注释掉这两行：</p>
<blockquote><p>
<code >//                if ( !empty($this-&gt;charset) &amp;&amp; version_compare(mysql_get_server_info(), '4.1.0', '&gt;=') )<br />
//                        $this-&gt;query("SET NAMES '$this-&gt;charset'");</code>
</p></blockquote>
<p>2、修改数据库编码，使其和你的wordpress编码相对应<br />
比如，可以修改数据库的编码为utf8。<br />
首先导出：</p>
<blockquote><p><code >mysqldump --default-character-set=latin1 -uroot yourdb &gt; yourdb.sql</code></p></blockquote>
<p>然后修改此文件，替换所有的latin1为utf8，并在文件头添加：</p>
<blockquote><p>    SET NAMES utf8;<br />
    SET CHARACTER_SET_CLIENT=utf8;<br />
    SET CHARACTER_SET_RESULTS=utf8; </p></blockquote>
<p>然后保存为yourdb-utf.sql，在进行数据库的导入工作：</p>
<blockquote><p><code >mysql -uroot<br />
mysql&gt;drop database yourdb<br />
mysql &gt;create database yourdb<br />
mysql -uroot yourdb&lt;yourdb-utf.sql</code></p></blockquote>
<p>此处的转换方法参考：<a href="http://wlx.westgis.ac.cn/378/">转换论坛：webwiz 7.9 -> phpBB3</a>。</p>
<p>我为了以后升级的方便，选择了第二种方法进行处理。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/451/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>imap_utf8()中转换GBK编码的问题</title>
		<link>http://wlx.westgis.ac.cn/418/</link>
		<comments>http://wlx.westgis.ac.cn/418/#comments</comments>
		<pubDate>Wed, 05 Sep 2007 11:10:35 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[gbk]]></category>
		<category><![CDATA[iconv]]></category>
		<category><![CDATA[imap_utf8]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[php5-imap]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/418/</guid>
		<description><![CDATA[服务器环境：ubunt feisty,php5.1.2,php5-imap 5.1.2-1ubuntu1
imap_utf8()不能转换GBK编码的汉字，GB2312没有问题
但可以使用iconv_mime_decode($string,0,"UTF-8")来进行代替
参考： https://bugs.launchpad.net/ubuntu/+source/php5/+bug/137475
BUG重现：
nano test.php
&#60;?php
echo imap_utf8("=?GBK?B?wbzP/A==?=");
echo "\n";
echo iconv_mime_decode("=?GBK?B?wbzP/A==?=",0,"UTF-8");
?&#62;
执行：
php5 test.php
]]></description>
			<content:encoded><![CDATA[<p>服务器环境：ubunt feisty,php5.1.2,php5-imap 5.1.2-1ubuntu1</p>
<p>imap_utf8()不能转换GBK编码的汉字，GB2312没有问题<br />
但可以使用iconv_mime_decode($string,0,"UTF-8")来进行代替</p>
<p>参考： https://bugs.launchpad.net/ubuntu/+source/php5/+bug/137475</p>
<p>BUG重现：<br />
nano test.php</p>
<blockquote><p><code >&lt;?php<br />
echo imap_utf8("=?GBK?B?wbzP/A==?=");<br />
echo "\n";<br />
echo iconv_mime_decode("=?GBK?B?wbzP/A==?=",0,"UTF-8");<br />
?&gt;</code></p></blockquote>
<p>执行：<br />
php5 test.php</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/418/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>trac安装及配置使用多仓库</title>
		<link>http://wlx.westgis.ac.cn/414/</link>
		<comments>http://wlx.westgis.ac.cn/414/#comments</comments>
		<pubDate>Thu, 30 Aug 2007 11:25:54 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[feisty]]></category>
		<category><![CDATA[multi]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[trac]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/414/</guid>
		<description><![CDATA[安装比较简单：
sudo aptitude install trac libapache2-mod-python
然后就是配置工作。
默认情况下，trac只能支持单一仓库。
若想支持多仓库，必须使用mod-python支持。
然后在配置站点的时候，使用TracEnvParentDir关键字。
如下：
&#60;Location /projects&#62;
  SetHandler mod_python
  PythonHandler trac.web.modpython_frontend
  PythonOption TracEnvParentDir /var/trac
  PythonOption TracUriRoot /projects
&#60;/Location&#62;
其中，/var/trac目录下就是预先定义的initenv目录。
sudo trac-admin /var/trac/project1 initenv
然后每个project都使用类似的操作。
注意，然后还要修改每个对应的trac.ini文件以满足自己的需求。
比如，中文utf8支持就要修改default_charset为utf8。
]]></description>
			<content:encoded><![CDATA[<p>安装比较简单：</p>
<blockquote><p>sudo aptitude install trac libapache2-mod-python</p></blockquote>
<p>然后就是配置工作。</p>
<p>默认情况下，trac只能支持单一仓库。<br />
若想支持多仓库，必须使用mod-python支持。<br />
然后在配置站点的时候，使用TracEnvParentDir关键字。<br />
如下：</p>
<blockquote><p><code >&lt;Location /projects&gt;<br />
  SetHandler mod_python<br />
  PythonHandler trac.web.modpython_frontend<br />
  PythonOption TracEnvParentDir /var/trac<br />
  PythonOption TracUriRoot /projects<br />
&lt;/Location&gt;</code></p></blockquote>
<p>其中，/var/trac目录下就是预先定义的initenv目录。<br />
sudo trac-admin /var/trac/project1 initenv<br />
然后每个project都使用类似的操作。<br />
注意，然后还要修改每个对应的trac.ini文件以满足自己的需求。<br />
比如，中文utf8支持就要修改default_charset为utf8。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/414/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>转换论坛：webwiz 7.9 -&gt; phpBB3</title>
		<link>http://wlx.westgis.ac.cn/378/</link>
		<comments>http://wlx.westgis.ac.cn/378/#comments</comments>
		<pubDate>Sun, 03 Jun 2007 08:56:00 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[convert]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[phpbb]]></category>
		<category><![CDATA[utf8]]></category>
		<category><![CDATA[webwiz]]></category>

		<guid isPermaLink="false">http://wlx.westgis.ac.cn/378/</guid>
		<description><![CDATA[webwiz是一个基于ASP的论坛，由于此官方论坛已经停止维护，官方网站很长时间无法登录了，由于ASP的先天缺陷，而且正好PHPBB3也已经到RC1了，就决定把这个论坛进行转换。
1、实际情况
我们使用的WEBWIZ 7.9使用的是ACCESS数据库，并且在使用过程中有一定的修改，但我不清楚有哪些修改，因此，你的转换若有问题，也请反馈你的实际情况。
头像有三种，一种是系统提供的，在avatars目录下，另一种是用户上传的头像，放在uploads目录下，还有一种是HTTP连接，就是放在另外网站上的头像。
WEBWIZ的附件是直接存放在uploads目录下，但数据库里没有任何相关信息。
WEBWIZ的密码是采用了HASHEncode+Salt的加密算法，和SHA1类似，但不同。
2、转换程序
phpBB3只提供了从phpbb2的升级程序，在phpbb的官方论坛上搜索到了一个从webwiz到phpbb2的转换程序，但其转换的内容不完整，因此就决定自己写一个。而且PHPBB3现在已经采用了UTF8编码，要求数据库也要采用UTF8编码，MYSQL 4.1之后的程序也提供了UTF8编码。
首先需要转换ACCESS数据库到MYSQL，我前面有介绍过如何进行转换。
我是使用了knoda进行数据转换的，在ubuntu系统下，注意，转换好后，数据库是默认为UTF8编码的。
转换完后，导出mysql数据。
mysqldump --default-character-set=latin1 -uroot yourdb &#62; yourdb.sql
要修改此SQL文件，使之成为UTF8编码。替换所有的latin1为utf8，并在文件的开始添加：
SET NAMES utf8;
SET CHARACTER_SET_CLIENT=utf8;
SET CHARACTER_SET_RESULTS=utf8;

然后转移到测试服务器上，并进行相应的导入工作。
在http://www.phpbb.com下载最新的phpbb3，根据安装提示，安装一个默认的空白的PHPBB3系统，假如你的数据库是phpbb。
并把webwiz论坛的所有文件拷贝到同一个服务器上，二者目录可以在一个层次。
如：

/var/www/phpbb
/var/www/webwiz
然后把我提供的转换程序拷贝到phpbb/install/convertors目录下，即convert_webwiz.php和functions_webwiz.php文件。
同时修改phpbb/includes/auth/auth_db.php文件，若你想让你的用户重新申请密码的话，也可以不修改这个文件。
	// Check password ...
	// added for webwiz conversion
	// HashEncode is webwiz function.
	global $phpbb_root_path, $phpEx;
	require($phpbb_root_path . 'includes/functions-webwiz-hash.' . $phpEx);
	if (!$row['user_pass_convert'] &#38;&#38; (md5($password) == $row['user_password']
		 or HashEncode($password.$row['salt'])==$row['user_password']))
	{
		if (md5($password)!=$row['user_password'])
		{
			// Unconverted password
			$sql = 'UPDATE ' . USERS_TABLE . '
				SET user_password = "'.md5($password).'"
				WHERE user_id = ' . $row['user_id'];
			$db-&#62;sql_query($sql);
		}
		if ($row['user_login_attempts'] [...]]]></description>
			<content:encoded><![CDATA[<p>webwiz是一个基于ASP的论坛，由于此官方论坛已经停止维护，官方网站很长时间无法登录了，由于ASP的先天缺陷，而且正好PHPBB3也已经到RC1了，就决定把这个论坛进行转换。</p>
<p>1、实际情况<br />
我们使用的WEBWIZ 7.9使用的是ACCESS数据库，并且在使用过程中有一定的修改，但我不清楚有哪些修改，因此，你的转换若有问题，也请反馈你的实际情况。<br />
头像有三种，一种是系统提供的，在avatars目录下，另一种是用户上传的头像，放在uploads目录下，还有一种是HTTP连接，就是放在另外网站上的头像。<br />
WEBWIZ的附件是直接存放在uploads目录下，但数据库里没有任何相关信息。<br />
WEBWIZ的密码是采用了HASHEncode+Salt的加密算法，和SHA1类似，但不同。</p>
<p>2、转换程序<br />
phpBB3只提供了从phpbb2的升级程序，在phpbb的官方论坛上搜索到了一个从webwiz到phpbb2的转换程序，但其转换的内容不完整，因此就决定自己写一个。而且PHPBB3现在已经采用了UTF8编码，要求数据库也要采用UTF8编码，MYSQL 4.1之后的程序也提供了UTF8编码。<br />
首先需要转换ACCESS数据库到MYSQL，我前面有介绍过如何<a href="http://wlx.westgis.ac.cn/353/">进行转换</a>。<br />
我是使用了knoda进行数据转换的，在ubuntu系统下，注意，转换好后，数据库是默认为UTF8编码的。<br />
转换完后，导出mysql数据。</p>
<blockquote><p><code>mysqldump --default-character-set=latin1 -uroot yourdb &gt; yourdb.sql</code></p></blockquote>
<p>要修改此SQL文件，使之成为UTF8编码。替换所有的latin1为utf8，并在文件的开始添加：</p>
<blockquote><p>SET NAMES utf8;<br />
SET CHARACTER_SET_CLIENT=utf8;<br />
SET CHARACTER_SET_RESULTS=utf8;
</p></blockquote>
<p>然后转移到测试服务器上，并进行相应的导入工作。</p>
<p>在http://www.phpbb.com下载最新的phpbb3，根据安装提示，安装一个默认的空白的PHPBB3系统，假如你的数据库是phpbb。<br />
并把webwiz论坛的所有文件拷贝到同一个服务器上，二者目录可以在一个层次。<br />
如：</p>
<blockquote><p>
/var/www/phpbb<br />
/var/www/webwiz</p></blockquote>
<p>然后把我提供的转换程序拷贝到phpbb/install/convertors目录下，即convert_webwiz.php和functions_webwiz.php文件。<br />
同时修改phpbb/includes/auth/auth_db.php文件，若你想让你的用户重新申请密码的话，也可以不修改这个文件。</p>
<blockquote><p><code>	// Check password ...<br />
	// added for webwiz conversion<br />
	// HashEncode is webwiz function.<br />
	global $phpbb_root_path, $phpEx;<br />
	require($phpbb_root_path . 'includes/functions-webwiz-hash.' . $phpEx);<br />
	if (!$row['user_pass_convert'] &amp;&amp; (md5($password) == $row['user_password']<br />
		 or HashEncode($password.$row['salt'])==$row['user_password']))<br />
	{<br />
		if (md5($password)!=$row['user_password'])<br />
		{<br />
			// Unconverted password<br />
			$sql = 'UPDATE ' . USERS_TABLE . '<br />
				SET user_password = "'.md5($password).'"<br />
				WHERE user_id = ' . $row['user_id'];<br />
			$db-&gt;sql_query($sql);<br />
		}</p>
<p>		if ($row['user_login_attempts'] != 0)</code></p></blockquote>
<p>这个前面的$sql语句中要添加一个字段：salt。</p>
<p>若修改了此文件，还要拷贝functions-webwiz-hash.php到phpbb/includes/目录下。<br />
然后就可以在PHPBB的安装界面那儿进行系统的转换了。</p>
<p>下载：<a href='http://wlx.westgis.ac.cn/uploads/2007/06/webwiz.zip' title='webwiz 7.9 converter'>webwiz 7.9 converter</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/378/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>phpbb 3.0 beta 3发布</title>
		<link>http://wlx.westgis.ac.cn/281/</link>
		<comments>http://wlx.westgis.ac.cn/281/#comments</comments>
		<pubDate>Wed, 15 Nov 2006 13:50:16 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[phpbb]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://wlxblog.westgis.ac.cn/281/</guid>
		<description><![CDATA[经过漫长的等待，终于要接近发布RC1版了。
这个beta3也有一个重大的变化：终于要全面支持UTF8了，这对中文来说真是个好消息。
不过感觉目前的phpbb3好像落后vb3很多，vb33已经全面支持ajax等功能，而phpbb要到3.2版本才会加入。
]]></description>
			<content:encoded><![CDATA[<p>经过漫长的等待，终于要接近发布RC1版了。<br />
这个beta3也有一个重大的变化：终于要全面支持UTF8了，这对中文来说真是个好消息。<br />
不过感觉目前的phpbb3好像落后vb3很多，vb33已经全面支持ajax等功能，而phpbb要到3.2版本才会加入。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/281/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mailman中的乱码问题</title>
		<link>http://wlx.westgis.ac.cn/204/</link>
		<comments>http://wlx.westgis.ac.cn/204/#comments</comments>
		<pubDate>Tue, 25 Jul 2006 01:04:02 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[gb2312]]></category>
		<category><![CDATA[iconv]]></category>
		<category><![CDATA[mailman]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://wlxblog.westgis.ac.cn/204/</guid>
		<description><![CDATA[mailman 2.1.8版本中，若采用中文，有时会遇到乱码，经检查，是其模板文件在翻译的时候有几个使用了gb2312编码，可以使用iconv使其全部转换为utf8编码，这样就应该ok了。
分别是/etc/mailman/zh_CN/目录下的postack.txt、postauth.txt、postheld.txt、unsub.txt。
]]></description>
			<content:encoded><![CDATA[<p>mailman 2.1.8版本中，若采用中文，有时会遇到乱码，经检查，是其模板文件在翻译的时候有几个使用了gb2312编码，可以使用iconv使其全部转换为utf8编码，这样就应该ok了。</p>
<p>分别是/etc/mailman/zh_CN/目录下的postack.txt、postauth.txt、postheld.txt、unsub.txt。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/204/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vb &amp; phpbb</title>
		<link>http://wlx.westgis.ac.cn/198/</link>
		<comments>http://wlx.westgis.ac.cn/198/#comments</comments>
		<pubDate>Mon, 15 May 2006 16:06:09 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[phpbb]]></category>
		<category><![CDATA[utf8]]></category>
		<category><![CDATA[vb]]></category>

		<guid isPermaLink="false">http://blog.mygis.org/198/</guid>
		<description><![CDATA[因为论坛要增加一个新版面，但是有问题，后来联系服务商才处理好。
在处理中，自己在本地机器上又搭起了apache2/php5/mysql5，下载了vb3.5，进行了简单的测试，感觉不错，好像vb要开始支持utf8了。
但从原来的gb2312转换到utf8好像还有一定的麻烦：
1、备份sql文件，好像有几个表要单独处理，如附件、头像等。
2、编码转换，iconv
不过，还是期待phpbb 3.0，vb的版本就不升级了。（不知道年底能否出来正式版，呵呵）
]]></description>
			<content:encoded><![CDATA[<p>因为论坛要增加一个新版面，但是有问题，后来联系服务商才处理好。</p>
<p>在处理中，自己在本地机器上又搭起了apache2/php5/mysql5，下载了vb3.5，进行了简单的测试，感觉不错，好像vb要开始支持utf8了。</p>
<p>但从原来的gb2312转换到utf8好像还有一定的麻烦：<br />
1、备份sql文件，好像有几个表要单独处理，如附件、头像等。<br />
2、编码转换，iconv</p>
<p>不过，还是期待phpbb 3.0，vb的版本就不升级了。（不知道年底能否出来正式版，呵呵）</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/198/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>文件名编码的转换工具：convmv</title>
		<link>http://wlx.westgis.ac.cn/117/</link>
		<comments>http://wlx.westgis.ac.cn/117/#comments</comments>
		<pubDate>Thu, 29 Sep 2005 08:39:15 +0000</pubDate>
		<dc:creator>wlx</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[convmv]]></category>
		<category><![CDATA[utf8]]></category>

		<guid isPermaLink="false">http://blog.mygis.org/117/</guid>
		<description><![CDATA[gnome的默认编码是UTF8，而很多FTP（特别是WIN下的）的编码是GBK，因此down下来后基本上中文都是乱码，原来一直都是手工改（好土啊），今天才知道LINUX自带了一个工具：convmv。若没有安装，可以直接apt-get install convmv。
比如，
convmv -f zh_CN.GB2312 -t UTF-8 -r --notest *
这个意思就是从GB2312转换到UTF8编码。
]]></description>
			<content:encoded><![CDATA[<p>gnome的默认编码是UTF8，而很多FTP（特别是WIN下的）的编码是GBK，因此down下来后基本上中文都是乱码，原来一直都是手工改（好土啊），今天才知道LINUX自带了一个工具：convmv。若没有安装，可以直接apt-get install convmv。<br />
比如，<br />
<code>convmv -f zh_CN.GB2312 -t UTF-8 -r --notest *</code><br />
这个意思就是从GB2312转换到UTF8编码。</p>
]]></content:encoded>
			<wfw:commentRss>http://wlx.westgis.ac.cn/117/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
