入力を安全に受け取る ref: http://qiita.com/memememomo/items/34e86058872b2fe508bb