相关主题

Farewell

今天是我在目前公司browser team的最后一天,明天我就要去新公司报道了。在这里的三年零五个月里,我作为mozilla社区的一个参与者经历了Mozilla 1.0的发布,Netscape的解散,Pheonix到Firefox的崛起,同时在公司内部一个版本接着一个版本的发布Mozilla,开发,维护。天下没有不散的宴席,在这个时候离开,心里至少不会有什么遗憾了。
Madfox的开发准备就这样停止了,如果不出意外,Madfox 0.3.2 update3就是最后一个Madfox的release。这样的一个项目,随着大家对互联网标准认识的不断深入,迟早是要停止的。疯补丁仍然以MPL的方式公布在网站上,给有兴趣研究的朋友一个参考。这个网站将完全转变成我的个人blog。
以前在bugzilla上看到一句话,大意是:在这个社区,你要么follow,要么leave。Firefox现在如日中天,follow的人太多了,不缺我一个,我还是leave吧。祝mozilla.org和Firefox能有更美好的明天。

发表评论

如何在Ruby On Rails中使用Unicode

这两天玩Ruby On Rails,测试中文输入的时候总是乱码。在Ruby On Rails的wiki里有一篇How To Use Unicode Strings,照着上面做,解决了部分问题,可在输入一些文字时仍然乱码,而且不是什么特殊的字符,比如“可”这个字,怎么都不对。google了半天也没有什么有价值的东西,最后祭出delicious,居然在rubyonrails+unicode的tag下找到了一篇Getting Unicode, MySql and Rails to Cooperate,终于解决了问题,目前看来还没有新问题出现。
总结一下,大概有这样几个要点:
在MySql这边,
1. 需要把Table的Type设置成为MyISAM而不是InnoDB。
2. 将Charecter设置成为utf8
就象这样:

create table samples (
id int not null auto_increment,
foo varchar(100) not null,
bar text not null,
primary key (id)
) Type=MyISAM CHARACTER SET utf8;

在Ruby On Rails这边,
1. 要设置enviroment.rb,加入

$KCODE = ‘u’
require ‘jcode’

2.在application.rb的ApplicationController中加入charset的设置,并显示告知MySql使用UTF8

class ApplicationController < ActionController::Base
before_filter :configure_charsets

def configure_charsets
@response.headers["Content-Type"] = “text/html; charset=utf-8″
# Set connection charset. MySQL 4.0 doesn’t support this so it
# will throw an error, MySQL 4.1 needs this
suppress(ActiveRecord::StatementInvalid) do
ActiveRecord::Base.connection.execute ‘SET NAMES UTF8′
end
end
end

然后就大功告成了。

4 条评论

Madfox 0.3.2 update3发布

Madfox 0.3.2 update3 is based on Firefox 1.0.7 with Madpatch version 0.3.2. Firefox 1.0.7 contains important security fix. Please update to Madfox 0.3.2 update3 as soon as possible.

Madfox 0.3.2 update3 基于 Firefox 1.0.7 ,仍然使用 Madfox 0.3.2版的补丁。 Firefox 1.0.7 中有重要的安全漏洞修改,所以请 Madfox 的用户升级到 Madfox 0.3.2 update3。
下载(DOWNLOAD)

发表评论

Recent Posts:

Recent Comments:

Archive:

Tags:

Bookmarks:

My music:

About Me:

I am a software engineer in Beijing, China. I write code for work and for fun. I am interested in web technology, life hacking and console games. This blog is dumped from my left brain.
View Robin Lu's profile on LinkedIn

My Flickr:

    drawingAt Modern Sky Music FestivalIMG_0389IMG_0312urumqi panaramaIMG_9664

Friends: