Wednesday, April 11, 2007

Set content type and charset --Quixote

Set python procedure character as Unicode as below:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Set editor (Vim) as Unicode, add "set encoding=utf-8" in _vimrc.
The last thing is let quixote tell browser that the coming content should be encoded as UTF-8. Before return the content in function, add code "get_response().set_content_type("text/html", charset="utf-8")". In order to use get_resonse(), "from quixote import get_response" first.

No comments: