Skip to content

Instantly share code, notes, and snippets.

@ukstudio
Created February 23, 2009 03:08
Show Gist options
  • Save ukstudio/68768 to your computer and use it in GitHub Desktop.
Save ukstudio/68768 to your computer and use it in GitHub Desktop.
#!/usr/local/env ruby
# -*- coding: UTF-8 -*-
# -*- coding: EUC-JP -*- #=> このmagic commentは無効
p "test".encoding #=> #<Encoding:UT-8>
# Magic Commentは1行目、もしくはshebangが1行目の場合は2行目の場合有効。
# Magic Commentが無い場合、US-ASCIIと判断される。
# Magic Commentの形式
# # coding: UTF-8
# # -*- coding: UTF-8 -*-
# # vim:set fileencoding=UTF-8:
# ちなみに上記3種類以外でも
# /coding[:=]\s*[\w.-]+/にマッチする形式が利用可能
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment