hoamon's sandbox
hoamon
hoamon's sandbox is about »
tag cloud
- aix
- ajax
- amd64
- android
- apache
- apple
- athletes
- bank
- baseball
- bike
- bitbucket
- blog
- bond
- book
- brooks
- bullshit
- car accident
- cds
- chrome
- civil engineering
- cloud computing
- cmclass
- computer
- construction management
- construction site management
- django
- drbl
- e-sun bank
- eclipse
- ecryptfs
- education
- election
- english
- environment
- fedora
- feeling
- finance
- firefox
- firegpg
- flash ram
- foclass
- football
- fortran
- freetds
- future
- genetic algorithm
- glassfish
- gnuplot
- google adsense
- google app engine
- google gears
- gpg
- graphviz
- gtalk
- hg
- history
- htc
- html5
- http
- https
- ibm
- iconv
- ie
- iloveit
- imagemagick
- infomation
- investment
- ipatbles
- ipp2p
- iptables
- ironman
- java
- javascript
- job
- jog
- joke
- jpg
- jquery
- jython
- kde
- knapsack problem
- latex
- learning
- least square method
- levenberg-marquardt method
- libsvm
- linux
- list
- lp
- mac
- marathon
- math
- matlab
- mencoder
- mercurial
- microsoft
- mod_python
- modelviz
- moinmoin
- monte carlo
- movie
- mplayer
- msn
- mssql
- mysql
- netbeans
- netfilter
- newton's method
- nfl
- odiogo
- offline system
- open source
- openid
- openoffice
- openssl
- option
- oracle
- p2p
- paypal
- pdf2jpg
- pdftojpg
- perl
- personal
- pgp
- php
- policy
- politic
- postgresql
- power
- program
- python
- python25
- r51
- realty
- reit
- restructured text
- ruby
- ruby on rails
- science
- screen
- securities
- seediq bale
- self-management
- shell script
- sis
- skype
- solaris
- something
- ssh
- ssl
- subversion
- sun
- swap
- sybase
- testcase
- the guass-newton method
- the steepest descent method
- thinkpad
- tortoisehg
- totero
- trac
- travel
- triathlete
- turbogears
- ubuntu
- un*x
- vedio
- version control
- vim
- virtual machine
- virtualbox
- vst
- web
- windows
- x86_64
- yahoo
- zfs
- zipcode
- zotera
- zotero
» 無法在 Windows 上的 NetBeans 作中文註解
為了讓 Python 程式能容易在團隊之間快速流動,我們要求大家在程式編碼上一律使用 utf8 。只要在程式檔的第一行宣告 #-*- coding: utf8 -*- 以及使用 utf-8 編碼存檔即可。
不過,在 Windows 中執行時,因為它還活在 cp950 的時代,所以我們還要在 Python 主安裝目錄中的 Lib/site-packages/sitecustomize.py 中加入
import sys
sys.setdefaultencoding('utf8')
這樣 python 程式在執行時,才不會遇到 UnicodeEncodeError (其實偶爾還是會遇到,原因是搞混了 Unicode 編碼及 UTF-8 編碼)。
而在使用 NetBeans 時,我們也會在 /etc/netbeans.conf 中設定 -J-Dfile.encoding=utf8 來讓 NetBeans 正常顯示程式中的 UTF-8 編碼中文字。
不過,在 mercurial commit 時,卻無法使用中文作註解。這時候,只要在 netbeans.conf 加入 -J-Dmercurial.encoding=utf8 即可。








