Skip to content

Commit

Permalink
Add command line argument to set $KCODE = UTF8.
Browse files Browse the repository at this point in the history
  • Loading branch information
brightchimp committed Oct 28, 2011
1 parent 1ea3938 commit b4903bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/god
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ begin
opts.banner = <<-EOF
Usage:
Starting:
god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]
god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D] [-U]
Querying:
god <command> <argument> [-p <port>]
Expand Down Expand Up @@ -69,6 +69,11 @@ begin
options[:daemonize] = false
end

# The tweet-text gem needs this in ruby < 1.8
opts.on("-U", "--utf8-charset", "Use UTF-8 character set (sets $KCODE to UTF8)") do
options[:utf8] = true
end

opts.on("-v", "--version", "Print the version number and exit") do
options[:version] = true
end
Expand Down
4 changes: 4 additions & 0 deletions lib/god/cli/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def dispatch
require 'god/sys_logger'
end

if @options[:utf8]
$KCODE = 'UTF8'
end

# run
if @options[:daemonize]
run_daemonized
Expand Down

0 comments on commit b4903bd

Please sign in to comment.